|
python+selenium+webdriver的环境刚搭好,测试了selenium安装没有问题,在测试webdriver调用Firefox的时候报错:UnicodeDecodeError: 'ascii' codec can't decode byte 0xd2 in position 7: ordinal not in range(128),
测试代码如下:
#-*- coding:UTF-8 -*-
from selenium import webdriver
browser = webdriver.Firefox()
browser.get("https://www.baidu.com")
browser.find_element_by_id("kw").send_keys("selenium")
browser.find_element_by_id("su").click()
browser.quit()
报错信息如下:
Traceback (most recent call last):
File "D:/test/yongli/test001.py", line 4, in <module>
browser = webdriver.Firefox()
File "D:\Program Files\Python27\lib\site-packages\selenium-2.53.1-py2.7.egg\selenium\webdriver\firefox\webdriver.py", line 103, in __init__
self.binary, timeout)
File "D:\Program Files\Python27\lib\site-packages\selenium-2.53.1-py2.7.egg\selenium\webdriver\firefox\extension_connection.py", line 49, in __init__
self.profile.add_extension()
File "D:\Program Files\Python27\lib\site-packages\selenium-2.53.1-py2.7.egg\selenium\webdriver\firefox\firefox_profile.py", line 91, in add_extension
self._install_extension(extension)
File "D:\Program Files\Python27\lib\site-packages\selenium-2.53.1-py2.7.egg\selenium\webdriver\firefox\firefox_profile.py", line 261, in _install_extension
if not os.path.isdir(os.path.dirname(os.path.join(tmpdir, name))):
File "D:\Program Files\Python27\lib\ntpath.py", line 85, in join
result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd2 in position 7: ordinal not in range(128)
各位大神,有谁知道什么原因吗,烦请告知,再次谢过
|
|