0
我正在使用兩個Firefox驅動程序來運行測試以顯示結果。我在我的電腦上使用了兩個屏幕。我可以通過Eclipse中運行的Java代碼自動在每個屏幕上打開驅動程序嗎?我可以在2個屏幕上打開2個Firefox驅動程序嗎?
謝謝。
我正在使用兩個Firefox驅動程序來運行測試以顯示結果。我在我的電腦上使用了兩個屏幕。我可以通過Eclipse中運行的Java代碼自動在每個屏幕上打開驅動程序嗎?我可以在2個屏幕上打開2個Firefox驅動程序嗎?
謝謝。
我想你應該並行運行測試用例https://saucelabs.com/java/se2/8
@RunWith(Parallelized.class)
public class WebDriverParallelTest {
private String browser;
private String os;
private String version;
public WebDriverParallelTest(String os, String version, String browser) {
super();
this.os = os;
this.version = version;
this.browser = browser;
}
@Parameterized.Parameters
public static LinkedList browsersStrings() throws Exception {
LinkedList browsers = new LinkedList();
browsers.add(new String[]{Platform.XP.toString(), "17", "firefox"});
//add any additional browsers here
return browsers;
}
private WebDriver driver;
@Before
public void setUp() throws Exception {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, browser);
capabilities.setCapability(CapabilityType.VERSION, version);
capabilities.setCapability(CapabilityType.PLATFORM, os);
this.driver = new RemoteWebDriver(
new URL("http://credential of sauce lab"), capabilities);
}
@Test
public void webDriver() throws Exception {
driver.get("http://www.amazon.com/");
assertEquals("Amazon.com: Online Shopping for Electronics, Apparel, Computers, Books, DVDs & more", driver.getTitle());
}
@After
public void tearDown() throws Exception {
driver.quit();
}
}