Selenium WebDriver + Firefox 哪个版本工作正常?
Selenium WebDriver + Firefox which version works fine?
我正在编写一个自动化脚本来测试网站登录。通过 Firefox IDE,我编写了 TestCase 步骤,它运行良好。我将测试用例导出为与 jUnit 4 兼容的 java 代码。
当我尝试通过 Eclipse(使用 firefox 浏览器)运行 java 代码时,它打开 Mozilla 主页或空白页面或代理问题(如果我的机器连接到公司局域网) .
我正在使用 Selenium 2.44 和 Firefox 版本 44..
我也在一些网站上读到关于 firefox 与 selenium 网络驱动程序的兼容版本。我对此很困惑。
请告诉我首选哪个版本的 Selenium Web 驱动程序、Firefox 和 Java..!!!
在下面添加我的 java 代码
public class Firefox {
private WebDriver driver;
private String PROXY = "proxy address:port";
private String baseUrl;
private boolean acceptNextAlert = true;
@Before
public void setUp() throws Exception {
// Code for setting up Firefox proxy
Proxy proxy = new org.openqa.selenium.Proxy();
proxy.setHttpProxy(PROXY)
.setFtpProxy(PROXY)
.setSslProxy(PROXY);
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(CapabilityType.PROXY, proxy);
driver = new FirefoxDriver(cap);
baseUrl = "url";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testFirefox() throws Exception {
driver.get(baseUrl);
for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try {
if ("".equals(driver.findElement(By.id("userId")).getText())) break;
}
catch (Exception e) {}
Thread.sleep(1000);
}
driver.findElement(By.id("userId")).sendKeys("user name");
driver.findElement(By.id("pwd")).sendKeys("password");
driver.findElement(By.id("sign-in")).click();
}
}
我发现并正在使用的最新稳定兼容配置是 selenium Webdriver 2.48.2 和 Firefox 41.0.2
从 https://www.mozilla.org/en-US/firefox/organizations/all/
下载 Firefox ESR
兼容Webdriver 2.48.2的Firefox稳定版浏览器。
Selenium WebDriver 2.48.2 不适用于 FF 44。
对于所有非原生事件,例如 JavascriptExecutor 事件,最新的 Firefox 始终与最新版本的 Selenium(2.x 版本)一起工作,但也有一些原生事件(例如 driver.navigate.to () 和 driver.click() 除了最后一个已知的本机支持的 Firefox 版本,它不会工作,它是 31.6.0 ESR。ESR 的更高版本可能会工作,但我没有读过任何地方。
我正在编写一个自动化脚本来测试网站登录。通过 Firefox IDE,我编写了 TestCase 步骤,它运行良好。我将测试用例导出为与 jUnit 4 兼容的 java 代码。
当我尝试通过 Eclipse(使用 firefox 浏览器)运行 java 代码时,它打开 Mozilla 主页或空白页面或代理问题(如果我的机器连接到公司局域网) .
我正在使用 Selenium 2.44 和 Firefox 版本 44.. 我也在一些网站上读到关于 firefox 与 selenium 网络驱动程序的兼容版本。我对此很困惑。
请告诉我首选哪个版本的 Selenium Web 驱动程序、Firefox 和 Java..!!!
在下面添加我的 java 代码
public class Firefox {
private WebDriver driver;
private String PROXY = "proxy address:port";
private String baseUrl;
private boolean acceptNextAlert = true;
@Before
public void setUp() throws Exception {
// Code for setting up Firefox proxy
Proxy proxy = new org.openqa.selenium.Proxy();
proxy.setHttpProxy(PROXY)
.setFtpProxy(PROXY)
.setSslProxy(PROXY);
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(CapabilityType.PROXY, proxy);
driver = new FirefoxDriver(cap);
baseUrl = "url";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testFirefox() throws Exception {
driver.get(baseUrl);
for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try {
if ("".equals(driver.findElement(By.id("userId")).getText())) break;
}
catch (Exception e) {}
Thread.sleep(1000);
}
driver.findElement(By.id("userId")).sendKeys("user name");
driver.findElement(By.id("pwd")).sendKeys("password");
driver.findElement(By.id("sign-in")).click();
}
}
我发现并正在使用的最新稳定兼容配置是 selenium Webdriver 2.48.2 和 Firefox 41.0.2
从 https://www.mozilla.org/en-US/firefox/organizations/all/
下载 Firefox ESR兼容Webdriver 2.48.2的Firefox稳定版浏览器。 Selenium WebDriver 2.48.2 不适用于 FF 44。
对于所有非原生事件,例如 JavascriptExecutor 事件,最新的 Firefox 始终与最新版本的 Selenium(2.x 版本)一起工作,但也有一些原生事件(例如 driver.navigate.to () 和 driver.click() 除了最后一个已知的本机支持的 Firefox 版本,它不会工作,它是 31.6.0 ESR。ESR 的更高版本可能会工作,但我没有读过任何地方。