Explore Courses Blog Tutorials Interview Questions
+1 vote
in DevOps and Agile by (19.7k points)

I'm using Selenium Webdriver in Python.

While running the script in a headless browser(phantomjs) I'm getting an URLError:

<urlopen error [Errno 111] Connection refused> 

Anyone can please help to handle this?

1 Answer

0 votes
by (62.9k points)

After doing some research, it seems to happen unpredictably but after I've made a few requests with Selenium / Phantom. If I create a new webdriver with

driver = webdriver.PhantomJS()

then, I am able to continue making requests. I suggest you use the same workaround.

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat Selenium certification!

Browse Categories