起初我尝试了标准“来自splinter import Browser”,但是我遇到了以下错误:
from splinter import browser
ImportError: No module named 'splinter'
现在,我通过git安装它,并确保创建了dist-packages。我已经尝试过python 2.7和3.现在,我正在使用以下内容:
#!/usr/bin/env python2 (get errors when changing to 3 as well)
import splinter
def navigate_to(web_page, how_long):
b = splinter.Browser()
b.visit(web_page)
给出以下
Traceback (most recent call last):
File "./hw", line 30, in <module>
navigate_to(platform_int, 60)
File "./hw", line 23, in navigate_to
b = splinter.Browser()
File "build/bdist.linux-x86_64/egg/splinter/browser.py", line 63, in Browser
File "build/bdist.linux-x86_64/egg/splinter/driver/webdriver/firefox.py", line 49, in __init__
File "/usr/local/lib/python2.7/dist-packages/selenium-3.3.1-py2.7.egg/selenium/webdriver/firefox/webdriver.py", line 145, in __init__
self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium-3.3.1-py2.7.egg/selenium/webdriver/common/service.py", line 74, in start
stdout=self.log_file, stderr=self.log_file)
File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
帮助?!