【发布时间】:2011-10-02 22:16:25
【问题描述】:
我有以下代码,虽然我设置了profile_directory Firefox webdriver 仍然尝试将设置存储在/tmp 文件夹中
profile = FirefoxProfile(profile_directory = '/home/sultan/profiles')
profile.set_preference('network.proxy.http', scheme);
profile.set_preference('network.proxy.http_port', self.proxy.get('port'));
异常代码:
File "/home/sultan/Repository/Django/monitor/app/utils.py", line 79, in start
request.perform(scan = scan, schedule = schedule)
File "/home/sultan/Repository/Django/monitor/app/request.py", line 230, in perform
profile1 = FirefoxProfile(profile_directory = '/home/sultan/profiles')
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_profile.py", line 97, in __init__
self._read_existing_userjs()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_profile.py", line 178, in _read_existing_userjs
f = open(os.path.join(self.profile_dir, 'user.js'), "r")
IOError: [Errno 2] No such file or directory: '/tmp/webdriver-py-profilecopy/user.js'
我做错了什么还是需要为 selenium 添加特定的配置设置?
【问题讨论】:
-
/home/sultan/profiles 是否包含多个配置文件?
-
是的,它应该包含多个配置文件,但现在它仍然将配置文件保存在 /tmp 中,原因是我尝试使用线程测试网站
-
您不应该指向一个配置文件文件夹而不是包含多个配置文件的文件夹吗?
-
是的,这个文件夹包含多个配置文件
标签: python firefox selenium webdriver