问题描述
我是硒测试的新手.我想在多个浏览器上针对 Internet Explorer、Firefox、opera 和 chrome 运行 selenium 测试用例
.我必须遵循什么方法.你们可以建议我哪个过程是最好的.
I am new to selenium testing. I want to run selenium test cases
on multiple browsers against internet explorer, Firefox, opera and chrome. What approach i have to follow. Can you people please suggest me which is the best process.
selenium web driver 是否支持多个浏览器???
Does selenium web driver supports multiple browsers or not???
我们已经编写了登录脚本.它分别在 Firefox、chrome 和 Internet Explorer 上运行成功.但我想按顺序为那些多个浏览器运行它.
We had written login script. It runs successful for Firefox, chrome and internet explorer individually. But i want to run it for those multiple browsers sequentially.
推荐答案
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class Sample {
private WebDriver _driver;
@Test
public void IEconfiguration() throws Exception {
System.setProperty("webdriver.ie.driver",
"D:/Softwares/Selenium softwares/drivers/IEDriverServer.exe");
_driver = new InternetExplorerDriver();
login();
}
@Test
public void FFconfiguration() throws Exception {
_driver = new FirefoxDriver();
login();
}
@Test
public void CRconfiguration() throws Exception {
System.setProperty("webdriver.chrome.driver",
"D:/Softwares/Selenium softwares/drivers/chromedriver.exe");
_driver = new ChromeDriver();
//_driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);
login();
}
public void login() throws Exception {
_driver.get("http://www.google.com");
}
}
在此之前,我们必须安装 Chrome 和 Internet Explorer 驱动程序 .exe 文件并运行它们.
Before that we have to install the chrome and internet explorer drivers .exe files and run those.
这篇关于针对多个浏览器运行 selenium webdriver 测试用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!