小编use*_*704的帖子

在PATH中找不到firefox二进制文件.确保安装了firefox.操作系统似乎是:VISTA

我无法在任何浏览器中运行我的脚本.以下是我为firefox获取的错误.firefox的安装位置是正确的.不知道出了什么问题.

我正在使用Firefox 15. Selenium Java 2.2.0和Eclipse Juno

我的测试用例如下:

import static org.junit.Assert.*;
import org.junit.After; 
import org.junit.Before; 
import org.junit.Test; 
import org.openqa.selenium.By; 
import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.firefox.FirefoxDriver;  
import org.openqa.selenium.firefox.FirefoxProfile;

public class FirstTest {
private WebDriver _driver;
@Before
 public void setUp() throws Exception {
System.setProperty("webdriver.firefox.driver","C:\\Program Files\\Mozilla Firefox15\\Firefox.exe");
FirefoxProfile firefoxProfile = new FirefoxProfile();
_driver = new FirefoxDriver(firefoxProfile);
}

@Test 
public void Login() throws Exception {
_driver.get("https://www.google.co.in/");
assertEquals("Google", _driver.getTitle());
_driver.findElement(By.id("lst-ib")).clear();
_driver.findElement(By.id("lst-ib")).sendKeys("selenium");
_driver.findElement(By.name("btnG")).click();
_driver.findElement(By.linkText("Selenium - Web Browser Automation")).click();
assertEquals(" ", _driver.getTitle());
assertEquals("Selenium - Web Browser Automation", _driver.getTitle());
} …
Run Code Online (Sandbox Code Playgroud)

java eclipse firefox webdriver

20
推荐指数
3
解决办法
9万
查看次数

标签 统计

eclipse ×1

firefox ×1

java ×1

webdriver ×1