I'm struggling with this error:
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
while using selenium module on my Ubuntu-server 22.04. The thing is that the same code works fine on my local PC with the same Ubuntu version.
For avoiding trivial questions:
Code:
# initial settings for selenium
driver_location = '/usr/bin/chromedriver'
binary_location = '/usr/bin/google-chrome'
options = Options()
options.binary_location = binary_location
options.add_argument('--headless')
service = Service(driver_location)
driver = webdriver.Chrome(service=service, options=options)
And again, I think I need somehow use the fact that this code works on my local PC. Maybe you guys can advise me what to check...
For people who struggle the same issue, you can try following code, works for me without any problems:
# initial settings for selenium
driver_location = 'chromedriver_location'
binary_location = 'google-chrome_location'
#options = webdriver.ChromeOptions()
options = Options()
options.binary_location = binary_location
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--headless')