Reputation: 1398
I've set up Eclipse with Maven and created a project adding Selenium and TestNG dependencies. I'm now trying to run my tests in Chrome and I know that I can set System.setProperty("webdriver.chrome.driver","C:\\path-to\\chromedriver.exe");
, but I've also seen somewhere that the path to chromedriver can be established in the run configurations, thus avoiding to add configuration lines to the code.
I tried setting up a run configuration like this:
And this is the code in my test:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
public class Demo {
@Test
public void demoTest(){
WebDriver driver=new ChromeDriver();
driver.manage().window().maximize();
driver.get("http://www.google.com");
driver.quit();
}
}
But after running project as "Maven test" I get this and nothing happens (Chrome is not opened):
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building project-name 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ project-name ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ project-name ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ project-name ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ project-name ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ project-name ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.737 s
[INFO] Finished at: 2017-07-01T08:36:03-03:00
[INFO] Final Memory: 11M/245M
[INFO] ------------------------------------------------------------------------
What am I missing?
Upvotes: 0
Views: 1106
Reputation: 11
Can you try to run as a JUNIT and run in DEBUG mode so you will find the exact error i think first of all the test class is not picked,
run in DEBUG mode JUNIT and debug the code.. Hoping this will help you.
Upvotes: 1