I am using the Selenium + PhantomJS driver in python. He sets up something like this:
desired_cap = {
'phantomjs.page.settings.loadImages' : False,
'phantomjs.page.settings.resourceTimeout' : 10000,
'phantomjs.page.settings.userAgent' : '...'
}
self.driver = webdriver.PhantomJS(desired_capabilities=desired_cap)
self.driver.set_window_size(1024, 768)
self.driver.set_page_load_timeout(10)
Than in a loop I request multiple pages using:
self.driver.get('page-url')
Everything works fine for about 5 minutes (~ 1 time in 2 seconds), after that I get an error message:
<urlopen error [Errno 111] Connection refused>
And it appears not only for the get method, but also for any method called self.driver. I think the connection to the instance is phantomjsfor some reason, for some reason, and the object cannot send commands to it.
phantomjs --version
2.0.1-development
uname -a
Linux wincode 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Everything works on the local machine.
source
share