System.setProperty("webdriver.chrome.driver", BaseClass.class.getResource("/chromedriver").getPath());driver = new ChromeDriver();
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/NSCBa3hv4pYJ.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.
I have done like using maven dependency plugin copied into specific location like(public static String WINDOWS_DIRECTORY="/target"+"/test"+"/chromedriver"+"/windows") here the chrome driver will get added then from code i pointed to this location using System.getProperty("user.dir");+target directory.
On Mon, Jun 18, 2012 at 10:46 AM, Tarun Kumar <tku...@gmail.com> wrote:
I have been using chrome driver in past as -System.setProperty("webdriver.chrome.driver", "path to chrome driver");I thought I could utilize the resource feature of maven and kept it in src/main/resources folder. Following this I invoke it from base class as -System.setProperty("webdriver.chrome.driver", BaseClass.class.getResource("/chromedriver").getPath());driver = new ChromeDriver();But while executing Junit test I encounter error -java.lang.IllegalStateException: The driver is not executable: /home/<path to project>/Commons/target/classes/chromedriverHas any one tried to use resource folder or any other approach with maven and chrome driver?ThanksTarun K
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/NSCBa3hv4pYJ.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.
--
Thanks&Regards,
S.PradeepKumar
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/WpY2k6wfeGcJ.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/i_XpAEuhiSsJ.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
URL url = FileUtils.class.getClassLoader().getResource(fileName);
I'm having a similar problem where I can't run chrome tests on a ubuntu box. Below is my code that I'm trying to run...with the fix stated above I'm confused on how I'd fix my code to get it to work? Any help would be appreciated.
public class Chrome {
private static ChromeDriverService service;
private WebDriver driver;
@BeforeClass
public static void createAndStartService() throws IOException {
service = new ChromeDriverService.Builder()
.usingChromeDriverExecutable(new File("src/test/resources/chromedriver"))
.usingAnyFreePort()
.build();
service.start();
}
@AfterClass
public static void createAndStopService() {
service.stop();
}
@Before
public void createDriver() {
driver = new RemoteWebDriver(service.getUrl(),
DesiredCapabilities.chrome());
}
@After
public void quitDriver() {
driver.quit();
}
@Test
public void testGoogleSearch() {
driver.get("http://www.google.com");
WebElement searchBox = driver.findElement(By.name("q"));
searchBox.sendKeys("webdriver");
}
}
Tarun,I think the file you downloaded dont have execution permission. add execution permission to the file. From terminal chmod +rwx chromedriver . even though the post is old and you would have found this solution long back . adding this reply for users who google with same issue :)
Ubuntu
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.
--
Thanks&Regards,
S.PradeepKumar
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/i_XpAEuhiSsJ.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/890b1c99-b7e6-4cc3-9765-5493d7125fd5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
My requirement is to provide the junit code to execute from command line. So, I am trying to run mvn test -Dtest=<my main test class>. When I do this, I get an error in target\surefire-reports directory which says "java.lang.IllegalStateException: The driver executable does not exist: c:\eclipse\testautomationws\alltrack\file:\C:\Users\bsri\.m2\repository\testautomation\browser\0.0.1-SNAPSHOT\browser-0.0.1-SNAPSHOT-tests.jar!\chromedriver.exe".
public
class ChromeWebDriver implements WebDriverInterface {
private WebDriver chromeWebDriverInstance;
private static org.slf4j.Logger testlogger = org.slf4j.LoggerFactory.getLogger(ChromeWebDriver.class);
public ChromeWebDriver() {
String path_to_chromedriver_executable=
this.getClass().getClassLoader().getResource("chromedriver.exe").getFile();
System.setProperty(
"webdriver.chrome.driver", path_to_chromedriver_executable);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
chromeWebDriverInstance = new ChromeDriver(capabilities);
}
public WebDriver startWebDriver() {
return chromeWebDriverInstance;
}