我正在使用TestNG框架編寫一個硒腳本。在selenium拋出NoSuchElement異常之前,我已經將顯式等待定義爲20秒。但腳本在執行期間不等待20秒,並在41毫秒內拋出異常。 我希望此腳本等待(僅使用顯式等待)或在拋出任何異常之前搜索web元素20秒。 以下是執行結果後面的腳本。 public class para {
WebDriver driver;
@BeforeClass
import java.util.Scanner;
public class fmax
{
public static void main(String[] args)
{
int max;
max = maxnum();
System.out.println("The max number is: " + max);
}
public static int maxnum()