0

I followed instructions at How to install Google Chrome to install Chrome. For some reasons, my Selenium script was not recognising it. I then installed Chromium and Firefox and the script worked fine. On further debugging, I found the issue is with the install location of these browsers.

Chromium: qa_user@jenkins:/usr/share/chromium-browser

Firefox: qa_user@jenkins:/usr/share/Firefox

enter image description here

Chrome:

enter image description here enter image description here

How can I get Chrome installed in /usr/share/Google-Chrome-Stable like Chromium and Mozilla?

Afsal
  • 161
  • 5
  • Probably, you should solve the issue at the level of your script. Not at the level as to where programs are installed. Google chrome is not open source, so it will be difficult to control the packaging and installation yourself. – vanadium Jun 08 '20 at 07:42
  • That makes sense. Just wanted to check if I can get the same location for all browsers so that I can use a generic script. Thanks. – Afsal Jun 08 '20 at 08:27

1 Answers1

0

This can be solved by adding the following arguments to the selenium driver

--remote-debugging-port=<port>

For Example,

chromeOptions = webdriver.ChromeOptions() 
chromeOptions.add_experimental_option("prefs", {"profile.managed_default_content_settings.images": 2}) 
chromeOptions.add_argument("--no-sandbox") 
chromeOptions.add_argument("--disable-setuid-sandbox")

chromeOptions.add_argument("--remote-debugging-port=9222") # this

chromeOptions.add_argument("--disable-dev-shm-using") chromeOptions.add_argument("--disable-extensions") chromeOptions.add_argument("--disable-gpu") chromeOptions.add_argument("start-maximized") chromeOptions.add_argument("disable-infobars") chromeOptions.add_argument("user-data-dir=.\cookies\test")

driver = webdriver.Chrome(chrome_options=chromeOptions) driver.get("https://google.com/") driver. Quit()