Selenium Firefox then Chrome and IE -
is possible run selenium test on firefox , same test on chrome , ie? how can this?
using java, can handle automatically required binaries (chromedriver, geckodriver, , iedriverserver.exe) means of webdrivermanager.
take complete example parameterized junit test case. notice test code single, , in test parameters (method data()
) chose browsers want run code (chrome, firefox, , internet explorer):
@runwith(parameterized.class) public class multiplebrowserstest { protected webdriver driver; @parameter public class<? extends webdriver> driverclass; @parameters(name = "{index}: {0}") public static collection<object[]> data() { return arrays.aslist(new object[][] { { chromedriver.class }, { firefoxdriver.class }, { internetexplorerdriver.class } }); } @before public void setuptest() throws exception { webdrivermanager.getinstance(driverclass).setup(); driver = driverclass.newinstance(); } @after public void teardown() { if (driver != null) { driver.quit(); } } @test public void test() { // test code here } }
Comments
Post a Comment