java - Exception on running IE web Driver -
i'm new in java, using automatic tests. please me i'm doing wrong code?
public static webdriver driver = null; public static webdriver getdriver() { if (driver == null) { file fileie = new file("src//test/java/iedriver.exe"); system.setproperty("webdriver.ie.driver", fileie.getabsolutepath()); } try { driver = new internetexplorerdriver(); } catch (exception e) e.printstacktrace(); }
try add desiredcapabilities code.
if (driver == null) { file fileie = new file("src//test/java/iedriver.exe"); system.setproperty("webdriver.ie.driver", fileie.getabsolutepath()); desiredcapabilities iecapabilities = desiredcapabilities.internetexplorer(); try { driver = new internetexplorerdriver(iecapabilities); } catch (exception e) { throw new runtimeexception(e); } }
the desiredcapabilities set properties webdriver. typical usecase set path type of webdriver if local installation doesn't correspond default settings.
you can read class desiredcapabilities , its' using here: desiredcapabilities
Comments
Post a Comment