在我的應用程序,當我打開一個頁面下拉菜單顯示,然後我需要點擊繼續按鈕。問題是下拉需要一些時間來加載值,但在我的代碼中點擊下拉加載之前。我嘗試了隱式等待和thread.sleep,但它有一段時間它的工作和一段時間不起作用。 。 代碼:在硒web驅動程序如何寫等待下拉等待,然後單擊一個按鈕
public class Home {
public static void main(String[] args) throws IOException, InterruptedException
{
File file1 = new File("C:\\Selenium\\IEDriverServer_Win32_2.35.3\\IEDriverServer.exe"); System.setProperty("webdriver.ie.driver", file1.getAbsolutePath());
WebDriver driver = new InternetExplorerDriver();
driver.get("http://10.120.13.100/");
driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
Thread.sleep(3000);
WebElement clickBtn = driver.findElement(By.id("btnHomeProceed"));
clickBtn.click();