-1

There is an existing question for the same problem but that question was not completely answered, so posting new question.

I am new to selenium and trying to execute the very basic script, but getting the compilation errors. I am using Eclipse Oxygen 4.7.2 and Selenium 3.8.1. I have added all the necessary Jar files and used the Geckodriver as well, still i am getting errors. Below are the error messages in the console window:

**"Exception in thread "main" java.lang.Error: Unresolved compilation problems:

package automationFramework;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class FirstTestCase {

 public static void main(String[] args) throws InterruptedException {
  // TODO Auto-generated method stub
  System.setProperty("Webdriver.gecko.driver","C:\\Users\\vermap6\\Downloads\\geckodriver-v0.19.0-win64\\geckodriver.exe");
  // Create a new instance of the Firefox driver
    WebDriver driver = new FirefoxDriver();
    
          //Launch the Online Store Website
    driver.get("http://www.google.com");
   
          // Print a Log In message to the screen
          System.out.println("Successfully opened the website www.google.com");
   
    //Wait for 5 Sec
    Thread.sleep(5000);
    
          // Close the driver
          driver.quit();
  
 }

}
WebDriver cannot be resolved to a type

FirefoxDriver cannot be resolved to a type"**

Can anybody tell me what mistake i am doing ? Attaching screenshots. Webdriver Error.png JAr Files in Selenium 3.8.1

Prabhat
  • 33
  • 9
  • Please do not post images of text. It is hard to search and harder to copy-paste. – SiKing Jan 29 '18 at 23:01
  • You say you added all necessary jars, but from the image I do not see selenium.jar. – SiKing Jan 29 '18 at 23:02
  • Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable example.](https://stackoverflow.com/help/mcve) – undetected Selenium Jan 30 '18 at 02:22
  • @SiKing I have added a sceenshot of jar files available in selenium 3.8.1 and i have added a code snippet as well. Could you please have a look and comment – Prabhat Jan 30 '18 at 05:15
  • 1
    Possible duplicate of [WebDriver cannot be resolved to a type FirefoxDriver cannot be resolved to a type](https://stackoverflow.com/questions/31739392/webdriver-cannot-be-resolved-to-a-type-firefoxdriver-cannot-be-resolved-to-a-typ) – JeffC Jan 30 '18 at 15:25
  • Did you include the client-combined-3.8.1.jar in your project? – SiKing Jan 30 '18 at 16:31
  • @SiKing Yes, Both "client-combined-3.81.jar" and "client-combined-3.81-sources.jar" were included in the project. – Prabhat Jan 30 '18 at 17:40
  • Refresh your project [F5], clean, and rebuild. I do not know what else to say. I use Maven to figure all this stuff for me. – SiKing Jan 30 '18 at 19:59

1 Answers1

0

The problem is about file permission. I guess you are using Mac or Linux and the default permission of the library doesn't allow Eclipse to read it. What you need is going to the directory in Terminal and then use sudo chmod to change the permission.

sudo chmod -R 755 ./

Then you may need to restart Eclipse.

Buaban
  • 5,029
  • 1
  • 17
  • 33
  • @Bauban I am on Windows 10. Any troubleshoot can you suggest for Windows 10 if applicable – Prabhat Jan 30 '18 at 15:21
  • @Prabhat Can you check permission of the files and folder? Go to the folder or file > Right Click > Property > Security. Then make sure that your username has the right to access them. – Buaban Jan 31 '18 at 03:52