Goal: Efficient headless browsing (with Python 3) for the Raspberry Pi
What I've Tried:
(using pip-3.2) Installed: selenium v2.45.0, pyvirtualdisplay v0.1.5
(using apt-get) Installed: xvfb (latest I think is v1.12.4?), iceweasel v31.5.3
Python 3 Code:
from selenium import webdriver
from pyvirtualdisplay import Display
display = Display(visibile=0, size=(800, 600)) # NOTE: Seems to work (non-headless)
display.start() # without these 2 lines
browser = webdriver.Firefox()
browser.get('http://www.google.com')
print(browser.page_source)
browser.quit()
Error:
Traceback (most recent call last):
File "/home/pi/Desktop/mail-finder.py", line 18, in <module>
browser = webdriver.Firefox()
File "/usr/local/lib/python3.2/dist-packages/selenium/webdriver/firefox/webdriver.py", line 59, in __init__
self.binary, timeout),
File "/usr/local/lib/python3.2/dist-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
self.binary.launch_browser(self.profile)
File "/usr/local/lib/python3.2/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 66, in launch_browser
self._wait_until_connectable()
File "/usr/local/lib/python3.2/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 105, in _wait_until_connectable
raise WebDriverException("Can't load the profile. Profile "
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: %s If you specified a log_file in the FirefoxBinary constructor, check it for details.