mardi 14 mai 2019

How to solve "Could not find or load main class.." in Eclipse workplace

I'm create chrome testing function in eclipse.

The program have no error. But wile executing the program it shows following error.

Error: Could not find or load main class CrossBrowserTesting.ChromeTesting Caused by: java.lang.ClassNotFoundException: CrossBrowserTesting.ChromeTesting

But I didn't have idea Why this error is appear. Because My code has no error.

I enclose my code as below,

package CrossBrowserTesting;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class ChromeTesting {
   public static void main(String[] args) {
       WebDriver driver;
       System.setProperty("webdriver.chrome.driver","\\selenium webdrivers\\chromedriver.exe");
       driver = new ChromeDriver();
       driver.get("https://www.example.com");
       driver.quit();

   }

}

My file structure is

-- Foldername
  -- src
    -- CrossBrowserTesting
       -- ChromeTesting

Aucun commentaire:

Enregistrer un commentaire