0
votes

i am learning selenium in eclipse but following error comes out-

Error: Main method not found in class driver, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application

i already added selenium jar and selenium standalone jar files in buildpath but error still exists, here's the code

 import org.apache.xpath.operations.String;
 import org.openqa.selenium.firefox.FirefoxDriver;


   public class driver{

   public static void main(String[] args)
    {
        new FirefoxDriver();

    }
    }

i thoroughly searched, but not able to find the solution , please help

1

1 Answers

1
votes

The problem is in your imports, you should not be using:

import org.apache.xpath.operations.String;

By doing this you're making the compiler use the "org.apache.xpath.operations.String" instead of the normal "java.lang.String" If you remove this import it will work just fine.

import org.openqa.selenium.firefox.FirefoxDriver;

public class App {
    public static void main(String[] args) {
        new FirefoxDriver();
    }
}