【发布时间】:2019-07-04 22:50:20
【问题描述】:
我正在学习 Selenium,我需要一些帮助。好的,我正在使用This 网站 。这是用例:
- 在搜索栏中输入文本(完成)
- 按搜索按钮。 (未完成)
我尝试使用 className 来单击按钮,但它不起作用
//then this method to search
void invokeChrome(){
try{
System.setProperty("webdriver.chrome.driver", "D:\\software testing\\chromedriver.exe");
web = new ChromeDriver();
web.manage().deleteAllCookies();
web.manage().window().maximize();
web.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
web.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
web.get("https://www.coursera.org");
}catch(Exception e)
{
System.out.println(e.getMessage());
}
}
我正在使用 Chromedrive 74 和 selenium:3.9.0 版本
【问题讨论】:
-
你在运行测试时遇到
compound class异常吗? -
是:org.openqa.selenium.InvalidSelectorException:无效选择器:不允许复合类名
-
@supputuri 有时我也会遇到此异常。对不起,我是 selenium 的新手,如果问一些蹩脚的问题:
org.openqa.selenium.WebDriverException: java.net.SocketTimeoutException: timeout
标签: selenium selenium-chromedriver