Reputation: 1
I have downloaded chromedriver.exe and eclipse, I have added through add external jars but while executing it gives me error
Error: Could not find or load main class demochrome.DemoChrome
package demochrome;
public class DemoChrome {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "E://chromedriver.exe");
System.out.println("Welcome to chrome");
}
}
Upvotes: 0
Views: 2857
Reputation: 60604
E://chromedriver.exe
is not a valid path. try E:/chromedriver.exe
or E:\\chromedriver.exe
Upvotes: 0
Reputation: 927
I recommend page factory pattern, working example:
public class NewTest {
String baseUrl = "http://google.com";
String driverPath= "C:\\chromedriver.exe";
WebDriver driver;
@BeforeTest
public void beforeTest() {
System.setProperty("webdriver.chrome.driver", driverPath);
driver = new ChromeDriver();
}
and in @Test
driver.get(baseUrl);
Maybe you changed class name in code (in project there's another name) and you have improper slash in "E://chromedriver.exe"
Upvotes: 1