Option values when creating drivers
options = webdriver.ChromeOptions() options.headless = True options.add_argument('--no-sandbox') options.add_argument("--disable-setuid-sandbox") options.add_argument("--disable-setuid-sandbox") options.add_argument('--disable-dev-shm-usage') chrome_deriver_manager = ChromeDriverManager() driver = webdriver.Chrome(chrome_deriver_manager.install(), options=options)
On the remote server(ubuntu on EC2) via ssh, Attempt to run Python scripts using selenium via nohup python3 ~~. py> ~/log.out &
It works well when maintaining the ssh connection with the server. But an error occurs a few seconds after disconnecting the ssh
selenium.common.exceptions.WebDriverException: Message: chrome not reachable (Session info: headless chrome=102.0.5005.61)
How do I complete the script even after I close the ssh connection?
I’ve already tried to terminate Chrome and Web Driver processes before executing the script
brower and web driver version info
> google-chrome --version Google Chrome 102.0.5005.61 > chromedriver --version ChromeDriver 102.0.5005.61 (0e59bcc00cc4985ce39ad31c150065f159d95ad3-refs/branch-heads/5005@{#819})
Advertisement
Answer
Try running screen
, hitting enter and then entering the nohup-command