在Eclipse中运行第一个Selenium测试后出现错误

时间:2019-07-17 15:16:42

标签: java selenium

Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for E:\i_Chile_Okeno Profile\i_Software Tester\Softwarez\Selenium Installations\new jars\selenium-server-standalone-3.9.1.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class org.apache.bsf.BSFManager not in module

我创建了另一个Java项目,并且在构建路径时,这次我选择Classpath而不是Modulepath。我复制粘贴了代码?(将类名更改为Day2),仍然收到以下错误消息:

Exception in thread "main" java.lang.Error: Unresolved compilation problem: at seleniumtest2/net.serenestudy.selenium.webdriver.basic.Day2.main(Day2.java:30)
package net.serenestudy.selenium.webdriver.basic;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Day2 {

    WebDriver driver;

    public void invokeBrowser() {


            try {
                System.setProperty("webdriver.chrome.driver","E:\\i_Chile_Okeno Profile\\i_Software Tester\\Softwarez\\Selenium Installations\\new jars\\chromedriver_win32.exe");
                driver = new ChromeDriver();
                driver.manage().deleteAllCookies();
                driver.manage().window().maximize();
                driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
                driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);

                driver.get("http://serenestudy.net");
            } catch (Exception e) {
                e.printStackTrace();
            }

            }

    public static void main(String[] args) {
        Day2 myObj = new Day2();
        myObj.invokeBrowser();

    }

}

1 个答案:

答案 0 :(得分:1)

此错误可能是因为您尝试在文件夹名称之间添加空格,从而导致了问题。 尝试同样的操作而没有空格!