Google-Colab-Selenium icon indicating copy to clipboard operation
Google-Colab-Selenium copied to clipboard

How to open selenium browser & make drive headful

Open Kamal-Moha opened this issue 6 months ago • 0 comments

I know that by default the driver is --headless meaning it's not able to open browser in colab. I'm trying to add custom option so as to make driver headful and show the interactive selenium browser.

import google_colab_selenium as gs
from selenium.webdriver.chrome.options import Options

custom_options = Options()
# Add custom options
custom_options.headless = False

driver = gs.Chrome(options=custom_options)

I have also tried; custom_options.add_argument('--headless=False')

After running all of the above, I expected drive to be headful and display browser.

from time import sleep
driver.get('https://www.chelseafc.com/en')
sleep(3)
print(driver.title)
driver.quit()

But I didn't see any browser opening up. Please help

Kamal-Moha avatar Aug 10 '24 20:08 Kamal-Moha