0
votes

I have some tests using JUnit and Selenium, and I need to run it on the Chrome browser. I downloaded the Chrome driver, and configure my SetUp() as:

@Before
public void SetUp() throws Exception{
    System.setProperty("webdriver.chrome.driver","");
    driver = new ChromeDriver();
    baseUrl = ;
    driver.get(baseUrl);    
    driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);//Wait 5 seconds to load the page
}

The ChromeDriver.exe are added in my "Referenced Libraries" folder.
When I'll run the tests, the following error is displayed: java.lang.exception: No runnable methods

Anybody know how can I fix this?

SOLUTION

1º Add the chromedriver in the path of your computer. 2º Update your setProperty as: System.setProperty("webdriver.chrome.driver","C:\\Users\\pedro_nazario\\Desktop\\ChromeDriver\\chromedriver.exe"); The second parameter must be the way where is your Chromedriver.exe in my case, the chromedriver are in a folder on desktop.

The most important thing, that you never forget When you'll run the tests, before, close your Chrome browser completely. Any chrome browser must be open before you run your tests. If have some chrome browser opened, the selenium will take a error in your screen.

1
If you change ChromeDriver() to FirefoxDriver() and run it again, do you get the same error?SiKing
No, in Firefox it's working finePedro Henrique

1 Answers

0
votes

According to the documentation, webdriver.chrome.driver should contain the path to the chromedriver executable:

System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");

Alternatively, you can add path to the chromedriver to the PATH environment variable.