dimanche 10 juillet 2016

How to excute selenium webdriver in linux without display


I am trying to use selenium webdriver in centos to test my webpage. But,I got an error message when I execute the process. Can someone help me? from pyvirtualdisplay import Display from selenium import webdriver display=Display(visible=0, size=(320, 240)).start() path = "/usr/bin/firefox" driver= webdriver.Firefox(path) driver.get("www.google.com") html_source = driver.page_source print html_source driver.close() And here is the error message: File "/var/www/test/test.py", line 19, in <module> driver= webdriver.Firefox(path) File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 54, in __init__ self.NATIVE_EVENTS_ALLOWED and self.profile.native_events_enabled) AttributeError: 'str' object has no attribute 'native_events_enabled'

Aucun commentaire:

Enregistrer un commentaire