I am trying to run a Python script with Selenium and PhantomJS in order to do some automatic tests for my website. I use a virtual server with Ubuntu 18.04 LTS 64bit.
Disclamer: I know that using PhantomJS is deprecated but I just want to test my script.
This is my Python script:
from selenium import webdriver
from xvfbwrapper import Xvfb
vdisplay = Xvfb()
vdisplay.start()
driver = webdriver.PhantomJS(service_args=[
"--ignore-ssl-errors=true",
"--debug=true",
"--webdriver-loglevel='DEBUG'"
])
driver.set_window_size(1120, 550)
driver.get("https://duckduckgo.com/")
print(driver.page_source)
driver.quit()
vdisplay.stop()
I am logged on to my server using SSH. Since I don't have an X display running, I simulate one using Xvfb.
Unfortunately I only got an empty html page:
<html><head></head><body></body></html>
This is my ghostdriver.log
It seems, that there is a network error:
Network - Resource request error: QNetworkReply::NetworkError(OperationCanceledError) ( "Operation canceled" ) URL: "https://duckduckgo.com/"I'm not sure why, because I definitely have a working network connection. I can't reproduce the error on my own computer either, because the Python script works as intended.
I use
Selenium 3.141.0
Python 3.6.9
PhantomJS 2.1.1