問題描述
我正在使用帶有 jdk13 和 selenium 3.0.1 .jar 文件的 eclipse 09-2019.
I am using eclipse 09-2019 with jdk13 and selenium 3.0.1 .jar file.
我的代碼是:
package package1;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Script1
{
public static void main(String[] args)
{
System.out.println("Hii");
System.setProperty("Webdriver.chrome.driver","E:\Selenium\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("http://www.google.com");
}
}
錯誤:
java.lang.module.InvalidModuleDescriptorException: Provider class org.apache.bsf.BSFManager not in module
推薦答案
InvalidModuleDescriptorException
InvalidModuleDescriptorException 被拋出讀取模塊描述符時發(fā)現(xiàn)模塊描述符格式錯誤或無法解釋為模塊描述符.
InvalidModuleDescriptorException
InvalidModuleDescriptorException is thrown when reading a module descriptor and the module descriptor is found to be malformed or otherwise cannot be interpreted as a module descriptor.
InvalidModuleDescriptorException 可以在以下任一情況下引發(fā):
InvalidModuleDescriptorException can be raised in either of the following scenarios:
- Java 項目的問題.
- Java 項目中的 Java 包存在問題.
- Java 包中的 Java 類存在問題.
但是,根據(jù) Does Selenium v??3.141 支持 Java 13? 似乎是 Selenium 仍然不支持 java-13.
However, as per the discussion in Does Selenium v3.141 support Java 13? it seems the latest version of Selenium still doesn't supports java-13.
戰(zhàn)略解決方案是安裝最新版本的 JDK 8u222 并執(zhí)行 @Tests
The strategic solution will be to install the latest version of JDK 8u222 and execute the @Tests
此外,您還需要在 System.setProperty()
行中將大寫字母 W 替換為小寫字母 w.因此,實際上,您需要替換:
Additionally, you also need to replace uppercap W with the lowercap w in the System.setProperty()
line. So, effectively, you need to replace:
System.setProperty("Webdriver.chrome.driver","E:\Selenium\chromedriver.exe");
有
System.setProperty("webdriver.chrome.driver","E:\Selenium\chromedriver.exe");
<小時>
其他注意事項
此外,請確保:
- Selenium 已升級到當前級別版本 3.141.59.
- ChromeDriver 已更新為當前 ChromeDriver v79.0.3945.36 級別.
- Chrome 已更新至當前 Chrome 版本 79.0 級別.(根據(jù) ChromeDriver v79.0 發(fā)行說明)
- Selenium is upgraded to current levels Version 3.141.59.
- ChromeDriver is updated to current ChromeDriver v79.0.3945.36 level.
- Chrome is updated to current Chrome Version 79.0 level. (as per ChromeDriver v79.0 release notes)
這篇關(guān)于“java.lang.module.InvalidModuleDescriptorException:提供程序類 org.apache.bsf.BSFManager 不在模塊中"ChromeDriver Selenium 出錯的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!