Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 99408

Selenium Phantomjs on headless server execution error

$
0
0

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

Viewing all articles
Browse latest Browse all 99408

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>