Sun*_*ian 1 java selenium-webdriver
我不能使用 Thread.sleep();
例外:
Selenium Webdriver中引发“未处理的异常类型InterruptedException”。
请帮助,在此先感谢。
由于您正在使用sleep()函数,因此可能会抛出InterruptedException。为了防止这种情况,必须进行处理。
您可以使用try-catch:
try{
Thread.sleep(5000);
}
catch(InterruptedException ie){
}
Run Code Online (Sandbox Code Playgroud)
或抛出:
public static void main(String args[]) throws InterruptedException{
Thread.sleep(5000);
}
Run Code Online (Sandbox Code Playgroud)
如果使用标准IDE进行编码,则将鼠标悬停在显示的错误上时,它将自动为您提供添加此选项的选项。
| 归档时间: |
|
| 查看次数: |
21004 次 |
| 最近记录: |