“The import org cannot be resolved” error with the imports in Eclipse Photon with selenium Standalone server 3.9.1

前端 未结 5 915
耶瑟儿~
耶瑟儿~ 2020-12-12 02:22

I\'m creating a basic selenium Webdriver program by adding the selenium jars and relative jars, below is my code. but when i try to resolve firefordriver and webdriver for i

相关标签:
5条回答
  • 2020-12-12 02:55

    Add selenium jars and other required jars to build path of your project in Eclipse and Rebuild the project.

    0 讨论(0)
  • 2020-12-12 02:56

    Add jars like this

    Right click on project --> Configure BuildPath --> Java Build Path Libraries -->

    Double click on JRE SYSTEM LIBRARY --> Then select alternate JRE

    From C:\Program Files (x86)\Java\jre7\lib your path where you store JRE

    Refer this answer

    0 讨论(0)
  • 2020-12-12 02:57

    delete module-info.java file or any other module file that was created at the time of creating the project. That will resolve the issue.

    0 讨论(0)
  • 2020-12-12 03:05

    You have to remove the module-info.java class from project it will works. Module info is not required for selenium project. So you can remove it :)

    0 讨论(0)
  • 2020-12-12 03:13

    This error message...

    The import org cannot be resolved
    

    ...implies that your program was unable to resolve the following imports:

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

    Your main issue for the imports not getting reslved is circular-dependency.

    Though you have added all the selenium jars and relative jars but you have named the program Module / Package as selenium as follows:

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

    This is causing a circular-dependency hence the imports are not getting resolved through the selenium related jars.

    Solution

    Changing/Modifying the Module / Package name from selenium to something else, e.g. myProgram will solve the issue.

    0 讨论(0)
提交回复
热议问题