selenium学习之路1-安装环境

1、配置环境:

按照http://www.cnblogs.com/mealrice/p/5495544.html介绍的方法配置环境后,运行报错:

Traceback (most recent call last):   File "D:\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\ service.py", line 74, in start     stdout=self.log_file, stderr=self.log_file)

File "D:\Programs\Python\Python35\lib\subprocess.py", line 676, in __init__     restore_signals, start_new_session)  restore_signals, start_new_session)   File "D:\Programs\Python\Python35\lib\subprocess.py", line 955, in _execute_ch ild     startupinfo) FileNotFoundError: [WinError 2] 系统找不到指定的文件。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):   File "test.py", line 4, in <module>     driver = webdriver.Firefox()   File "D:\Programs\Python\Python35\lib\site-packages\selenium\webdriver\firefox \webdriver.py", line 142, in __init__     self.service.start()   File "D:\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\ service.py", line 81, in start     os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable  needs to be in PATH.

解决方法:

1:从 https://github.com/mozilla/geckodriver/releases/下载geckodriver,把下载的驱动放在环境变量里,运行正常

 

来自:http://www.cnblogs.com/linux-wangkun/p/6091402.html:程序执行错误,浏览器没有打开,那么应该是没有把 Firefox 驱动没有配置在环境变量里。下载驱动,然后将驱动文件路径配置在环境变量即可。

  下载地址: https://github.com/mozilla/geckodriver/releases/

  下载完成后将其加压到/usr/local/bin目录中,然后再在执行,我们看到直接就弹出浏览器并且其页面是百度。

Python最好用2.7的版本啊,血的教学,后面安装wxpython麻烦的很

wxpython要安装:2.8.12.1的版本下载地址:http://sourceforge.net/projects/wxpytho
n/files/wxPython/2.8.12.1/,不然后面运行RIDE的时候打不开报错:

>>> from robotide import main
Wrong wxPython version.
You need to install wxPython 2.8.12.1 with unicode support to run RIDE.
wxPython 2.8.12.1 can be downloaded from http://sourceforge.net/projects/wxpytho
n/files/wxPython/2.8.12.1/

 

 

posted on 2017-06-23 19:35  张&娟  阅读(144)  评论(0编辑  收藏  举报

导航