我使用的是带有selenium的junit注释。在运行chromedriver时,我得到以下异常:
org.openqa.selenium.InvalidArgumentException: invalid argument: entry 0 of 'firstMatch' is invalid
from invalid argument: cannot parse capability: browserName
from invalid argument: must be a string
以下是课程:
static WebDriver driver;
@BeforeClass
public static void setup(){
System.setProperty("webdriver.chrome.driver","C:\\webdrivers\\chromedriver_114.exe");
driver=new Chromedriver ();
driver.get("https://my-testing-link");
}
@Test
public void login(){}
}
chrome驱动程序已成功启动,但随后出现此异常。我没有使用能力类,所以我不确定到底是什么异常。我用的是硒3.6。我已经在我的项目中手动添加了jar(seleniumJava、seleniumSupport、selenium-chrome驱动程序、seleniumApi)。我知道我可以使用Testng注释,但我被告知只需使用selenium和junit编写测试。
我尝试更新到最新的jar并添加DesiredCapabilities类,但出现了同样的异常。任何建议都是有用的