I am running git lab ci cd pipeline for selenium Python UI automated tests. My tests are passing ok on my local. I have initialized Google Chrome using below code
driver = chromedriver_autoinstaller.install()
options = webdriver.ChromeOptions()
prefs = {'profile.default_content_setting_values.automatic_downloads': 1}
options.add_experimental_option("prefs", prefs)
driver = webdriver.Chrome(options=options)
When I am running GitLab job, my pipeline is failing with below error
Below if the GitLab runner I can see used while running :
I also tried to used remote driver and headless mode- In headless mode most of tests are failing. In remote mode, it not instantiating driver. Remove driver code as below
elif self.browser == 'remote':
driver = webdriver.Remote(options=webdriver.ChromeOptions(), command_executor='http://selenium__standalone-chrome:4444/wd/hub')
I am not sure if its happening due to gitlab runner. Or Do I need to create my custom gitlab runner to run on specific machine. I am running selenium UI tests , so not sure runner which is used in my case don't have facility to run in GUI mode.
I found similar issue here- WebDriverException: Message: unknown error: Chrome failed to start: crashed error using ChromeDriver Chrome through Selenium Python on Amazon Linux
Tried below code but still same issue
options = Options()
options.binary_location = '/usr/bin/google-chrome'
driver = webdriver.Chrome(options=options,
executable_path='/usr/local/bin/chromedriver')
I am spinning image with -Docker executor with image joyzoursky/python-chromedriver:3.8