Not sure if this will help, but I have some ideas that have helped me figure out issues with PhantomJS in the past.
First, as you say, it works on a different machine, you can test other versions of PhantomJS by downloading the executable and specifying the path to your Python script. Version 1.9.8 helped me bypass some security restrictions in the past (I also left some settings in case this might be of interest).
driver = webdriver.PhantomJS( executable_path='/path/to/the/downloaded/phantomjs19', # you can specify args, such as: service_args=[ '--ignore-ssl-errors=true', '--ssl-protocol=any', '--web-security=false', ], # and also other capabilities: desired_capabilities={ 'phantomjs.page.settings.resourceTimeout': '5000', 'phantomjs.page.settings.userAgent': ( "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/53 " "(KHTML, like Gecko) Chrome/15.0.87" ), }, )
You can also try to find out if updating Selenium helps.
pip install selenium
Another idea that can help you understand what is happening is to try to print a screenshot and log the page source before an error occurs. You can do it like:
# Set the window size to something appropriate for your tests. driver.set_window_size(900, 800) driver.save_screenshot('screen.png')
Please let me know if this helps!
source share