Java 使用selenium for MAC OS启动firefox浏览器时遇到问题

Java 使用selenium for MAC OS启动firefox浏览器时遇到问题,java,selenium,cross-browser,selenium-rc,Java,Selenium,Cross Browser,Selenium Rc,我正在使用Selenium在Java中测试一个网站,并尝试在MAC上的Firefox中运行它。但是当我试图执行下面的代码时 Selenium selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.example.com/"); 我得到以下运行时异常 java.lang.RuntimeException: Could not start Selenium session: Failed to start

我正在使用Selenium在Java中测试一个网站,并尝试在MAC上的Firefox中运行它。但是当我试图执行下面的代码时

Selenium selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.example.com/");
我得到以下运行时异常

java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: Browser not supported: /Users/sumitghosh/Desktop/*firefox3
(Did you forget to add a *?)

Supported browsers include:
  *firefox
  *mock
  *firefoxproxy
  *pifirefox
  *chrome
  *iexploreproxy
  *iexplore
  *firefox3
  *safariproxy
  *googlechrome
  *konqueror
  *firefox2
  *safari
  *piiexplore
  *firefoxchrome
  *opera
  *iehta
  *custom
我还尝试将浏览器更改为
*googlechrome
,但出现了相同的错误

但是当使用
*safari
时,它成功地运行了


由于我希望该应用程序也能在Windows和MAC上运行,所以我尝试运行
*firefox
*googlechrome
,但这两种浏览器在Windows和MAC上都有例外

代替
“*firefox”
您可以尝试
“*firefox/Apps/firefox/firefox.exe”
或任何其他适用于您的计算机的文件firefox.exe的绝对路径。

我只有firefox 3.X可以在MACOSX上使用selenium


尝试下载并安装3.X版本(我有3.18版本可以使用)。

您使用的Firefox版本是什么?您是否在指定位置安装了Firefox?你能用同样的代码在Windows上启动Firefox吗?顺便说一句,这不是selenium2的问题。@Slanec即使我没有为safari指定任何路径,它也可以正常工作!!但是我不知道firefox有什么问题!!不,我甚至不能用相同的代码启动firefox!!我尝试过给出绝对路径,比如selenium=newdefaultselenium(“localhost”,4444,“/Users/mypc/Desktop/Firefox.app”,”);我也尝试过使用不同的扩展名,比如firefox.exe,但也没有扩展名,但仍然引发了相同的异常!!即使它有效,还有其他方法可以避免硬编码,因为我将在不同的平台上运行应用程序!!这很奇怪。我想你真的有不受支持的firefox版本。我认为s 3、3.5和3.6应该可以工作。也许你是对的,我的浏览器版本是Mozilla 11.0!!我会尝试3.5版!!但是selenium对浏览器有兼容性问题吗?对于新的Firefox(和其他更新的浏览器),您应该使用WebDriver API,也称为Selenium 2。最初的Selenium RC现在已被正式弃用。新的WebDriver在新浏览器上运行得非常好,尽管浏览器开发人员和Selenium开发人员之间一直存在竞争。