Reputation: 815
I have a properties file that i use to load the location of the different install locations for chrome:
mac.chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
win.xp.chrome="%HOMEPATH%\\Local Settings\\Application Data\\Google\\Chrome\\Application\\chrome.exe"
win.7.chrome="C:\\Users\\%USERNAME%\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe"
linux.chrome="//usr//bin//google-chrome"
I read these in, and as debug when i set the webdriver.chrome.driver prop i log it:
System.setProperty("webdriver.chrome.driver", (String)props.get("mac.chrome"));
log.logInfo("Mac Chrome Driver Property Set To: " + System.getProperty("webdriver.chrome.driver"));
logger output:
INFO: Mac Chrome Driver Property Set To: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
When i execute my test i see the below error:
[junit] The driver executable does not exist: /Users/<user>/eclipseproject/automation/com/gui/"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
[junit] java.lang.IllegalStateException: The driver executable does not exist: /Users/<user>/eclipseproject/automation/com/gui/"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
[junit] at com.google.common.base.Preconditions.checkState(Preconditions.java:176)
[junit] at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:117)
[junit] at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:112)
[junit] at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:75)
[junit] at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:107)
[junit] at drivermanager.DriverManagement.initializeDriver(DriverManagement.java:46)
[junit] at tests.TestChromeChrome.setUp(TestAlerts.java:44)
I see in the error that the absolutePath is published, which makes sense as DriverService.checkExecutable does an exe.getAbsolutePath() call, but i don't understand why the path to my project is also included. If anyone have any suggestions that would be awesome!
Upvotes: 2
Views: 2632
Reputation: 815
Needed to setup the proper DesiredCapabilities object for chrome before the browser started to launch correctly. Also needed to remove the "" from my properties file (which resolved the IllegalStateException).
Upvotes: 1