'Helium/Selenium Headless browser problem on Centos8
I have been successfully testing this piece of python3 code to automate a login process via helium, on my macbook
from helium import *
browser = start_chrome('https://example.com/sign_in')
wait_until(Text("Sign In").exists)
write('[email protected]', into='email')
write('example', into='password')
click(S(".icheckbox"))
time.sleep(5)
click("Sign in")
time.sleep(10)
click("Home")
go_to("https://example.com/appointment")
content = get_driver().find_element_by_tag_name('pre').text
print(content)
kill_browser()
It works as intended. When I run it on the terminal, it opens up chrome and follows the instructions. But when I try to run the same code on my centos8 vps server(i have installed exactly the same chrome version and helium version) I encounter a problem.
raise RuntimeError(self.DRIVER_REQUIRED_MESSAGE)
RuntimeError: This operation requires a browser window. Please call one of the following functions first:
I try running the same code with -headless parameter
options.add_argument('--no-sandbox')
options.add_argument('headless')
options.add_argument("--disable-extensions")
options.add_argument("--start-maximized")
options.add_argument("window-size=1400,600")
browser = start_chrome("https://example.com", options=options)
It doesn't log in at all. At the moment I remove headless and sandbox
options = ChromeOptions()
options.add_argument("--disable-extensions")
options.add_argument("--start-maximized")
options.add_argument("window-size=1400,600")
browser = start_chrome("https://example.com/sign_in", options=options)
I get
(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.)
I was thinking maybe I should install desktop version of centos on my vps? Has anyone encountered this scenario before, if so what was the solution you went with?
Thank you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
