0

I just started learning Selenium with Java. However, my question is more around Java as I am new to that as well. I am using Eclipse to create the Java project and added all the required libraries to the build path. I guess this is how I can refer to these libraries using the 'import' statement in my classes.

So, I am getting these errors like:

The import org.openqa.selenium.chrome cannot be resolved.

Even the standard Java libraries could not be imported.

Almost all the solutions on StackExchange or elsewhere suggest the solution as to add these libraries to the Buildpath, which I have done.

I have already setup the Path variable to JDK bin. I do not know what else I am missing.

Thanks, vishnu.b

Yannick
  • 813
  • 8
  • 17
  • Hi Vishnu, from what I can tell, you've done the right thing. To me, this looks more like an IDE configuration issue. Can you confirm that also classes that are part of the standard JDK can't be imported (e.g. java.lang.String?). If so, please check that the IDE is configured correctly - especially around that it knows where to find your Java JDK. (haven't used eclipse in a long while, so I can't give you more detailed information) – Matthias Oct 30 '18 at 07:58
  • https://stackoverflow.com/questions/52245708/the-type-org-openqa-selenium-chrome-chromedriver-is-not-accessible – RamanaMuttana Oct 30 '18 at 09:19
  • Which is version of your selenium webdriver ? and try this `import org.openqa.selenium.chrome.ChromeDriver; ` – Ashish Kamble Oct 30 '18 at 09:33
  • Hi @MatthiasHuttar, Yes I can not access the stand JDK also. Same error. Let me check through the Eclipse settings. Thanks! vishnu.b – vishnu.b Oct 30 '18 at 09:44
  • Nope, I haven't named my package as Selenium. – vishnu.b Oct 31 '18 at 06:22
  • I don't know why people have marked my question as a duplicate. But, it is not. The question is basically about resolving the types/imported packages which I am facing with general Java libraries as well. A lot of people here are suggesting what to import etc. which I already know. I think my problem is more with the setup of java and eclipse itself. Seems Mr. Selcuk Ayhan and Mr. Mtthias Huttar at least understood what my problem is. – vishnu.b Oct 31 '18 at 06:28
  • I got this resolved myself. I just reviewed all my setup once again. The elipse I am using was taking java SE-10 by default as the libraries. I just tried the previous versions like 9 and 8 and the issue got resolved for Java SE -1.8. I do not exactly know what is the difference but it worked for Java SE - 1.8. – vishnu.b Nov 02 '18 at 12:22

1 Answers1

0

You should give permissions to Eclipse to read and write files. In order to execute Eclipse as your user you'll have to take ownership on the whole directory by running following code on terminal :

sudo chown -R $USER:$USER /eclipseDirectory
sayhan
  • 1,168
  • 1
  • 16
  • 22
  • Hi Mr.@Selcuk Ayhan, That sounds reasonable. Do I require any batch/exe to run the above command? It is not recognized on my machine as of now. My machine spec is: WIndows 10 OS. – vishnu.b Oct 31 '18 at 06:30
  • Hi @vishnu.b, please try solution in the link. https://stackoverflow.com/questions/2928738/how-to-grant-permission-to-users-for-a-directory-using-command-line-in-windows – sayhan Oct 31 '18 at 07:36