如何显式指定Selenium的Firefox的路径? [英] How to explicitly specify a path to Firefox for Selenium?

查看:163
本文介绍了如何显式指定Selenium的Firefox的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了Selenium IDE,接着这个帖子

a>,得到

  python test_default_server.py 

,它抱怨Firefox不在我的路径中:

 请添加目录包含firefox.exe到您的PATH环境
变量,或明确指定一个Firefox 3的路径,如下所示:
* firefox3c:\blah\firefox.exe

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



Selenium 1.0.1,Python 2.5,Windows XP。

解决方案


$ b $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ code>* firefox C:\\Program Files\\Mozilla Firefox\\firefox.exe

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



更新:你在哪里实例化浏览器吗?
由问题中的标签,我想你是一个蟒蛇人:
$ b $ pre $ def setUp(self):
self.verificationErrors = []
self.selenium = selenium(localhost,4444,* firefox C:\\Program Files\\Mozilla Firefox\\firefox.exe ,http:// change-this-to-the-site-you-are-testing /)
self.selenium.start()


I got Selenium IDE, followed this post, got to

python test_default_server.py

and it complains Firefox is not in my path:

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

I could change my PATH environment variable, but I'd rather pursue the local config option they are mentioning ("explicitly specify a path"). How do I do that? What does the "*firefox3c" refer to?

Selenium 1.0.1, Python 2.5, Windows XP.

解决方案

You have to use the following string when you instantiate selenium instead of just "*firefox":

"*firefox C:\\Program Files\\Mozilla Firefox\\firefox.exe"

Notice: I'm not sure that path is correct, but it should be a similar one.

Update: Where do you instantiate your browser? By the tags in the question I suppose you're a python guy:

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

这篇关于如何显式指定Selenium的Firefox的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆