Sunday, 15 September 2013

java - Can`t use IE and Chrome WebDrivers after pom.xml added -



java - Can`t use IE and Chrome WebDrivers after pom.xml added -

as requirement maven appeared, added pom.xml project , converted existing project maven one. stack trace ie webdriver start. similar chrome. ff runs perfectly; , strange, safari runs.

java.lang.illegalstateexception: driver executable not exist: c:\users\yuliya.savytska\.m2\repository\org\seleniumhq\selenium\selenium-ie-driver\2.44.0\selenium-ie-driver-2.44.0 @ com.google.common.base.preconditions.checkstate(preconditions.java:197) @ org.openqa.selenium.remote.service.driverservice.checkexecutable(driverservice.java:117)

my pom.xml: `http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 org.sonatype.mavenbook.simple webdriverbasics jar 1.0-snapshot webdriverbasics http://maven.apache.org

<build> <plugins> <plugin> <artifactid>maven-compiler-plugin</artifactid> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>4.10</version> </dependency> <dependency> <groupid>org.seleniumhq.selenium</groupid> <artifactid>selenium-java</artifactid> <version>2.44.0</version> </dependency> </dependencies>

`

and phone call of driver in code:

private static webdriver getdriver(){ if (driver == null) { string browser = getbrowsertype(); switch (browser) { case "firefox": driver = new firefoxdriver(); driver.manage().window().maximize(); break; case "chrome": system.setproperty("webdriver.chrome.driver", "c:\\users\\yuliya.savytska\\.m2\\repository\\org\\seleniumhq\\selenium\\selenium-chrome-driver\\2.44.0\\selenium-chrome-driver-2.44.0"); chromeoptions chromeoptions = new chromeoptions(); chromeoptions.addarguments("test-type"); chromeoptions.addarguments("start-maximized"); driver = new chromedriver(chromeoptions); driver.manage().window().maximize(); break; case "iexplorer": system.setproperty("webdriver.ie.driver", "c:\\users\\yuliya.savytska\\.m2\\repository\\org\\seleniumhq\\selenium\\selenium-ie-driver\\2.44.0\\selenium-ie-driver-2.44.0"); driver = new internetexplorerdriver(); break; case "safari": desiredcapabilities dcap = desiredcapabilities.safari(); dcap.setplatform(platform.mac); driver = new safaridriver(dcap); break; default: throw new runtimeexception(); } } homecoming driver; }

my m2_repo on it`s place , these drivers jars on location mentioned in code. (this way of getting absolute path me stinky, if ideas perfect)

before used chromedriver , iedriver exe files , without maven - working properly.

any ideas wrong webdrivers , maven?

"webdriver.chrome.driver" , "webdriver.ie.driver" rather refer standalone apps can download @

https://code.google.com/p/selenium/wiki/chromedriver

and

https://code.google.com/p/selenium/wiki/internetexplorerdriver

safari , firefox don't require this, running out-of-the-box. might need path chrome binary, this

chromeoptions.setbinary(new file("the path chrmoe binary"));

java eclipse maven selenium-webdriver

No comments:

Post a Comment