加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python – 如何显式指定Firefox的Selenium路径?

发布时间:2020-12-16 23:04:58 所属栏目:Python 来源:网络整理
导读:我得到了Selenium IDE,接着是 this post,到了 python test_default_server.py 并且它抱怨Firefox不在我的路上: Please add the directory containing ''firefox.exe'' to your PATH environmentvariable,or explicitly specify a path to Firefox 3 like th
我得到了Selenium IDE,接着是 this post,到了
python test_default_server.py

并且它抱怨Firefox不在我的路上:

Please add the directory containing ''firefox.exe'' to your PATH environment
variable,or explicitly specify a path to Firefox 3 like this:
*firefox3c:blahfirefox.exe

我可以改变我的PATH环境变量,但我宁愿追求他们提到的本地配置选项(“明确指定一个路径”).我怎么做? “* firefox3c”是指什么?

Selenium 1.0.1,Python 2.5,Windows XP.

解决方法

当您实例化硒而不是“* firefox”时,您必须使用以下字符串:
"*firefox C:Program FilesMozilla Firefoxfirefox.exe"

注意:我不确定路径是否正确,但应该是类似的.

更新:您在哪里实例化浏览器?
通过问题中的标签,我想你是一个Python的家伙:

def setUp(self):
    self.verificationErrors = []
    self.selenium = selenium("localhost",4444,"*firefox C:Program FilesMozilla Firefoxfirefox.exe","http://change-this-to-the-site-you-are-testing/")
    self.selenium.start()

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读