在我的应用程序中,当我打开一个页面时,会显示一个下拉列表,然后我需要单击一个继续按钮.问题是下拉需要一些时间来加载值,但在我的代码中,它在下拉加载之前单击.我尝试使用隐式wait和thread.sleep但它有时候它工作,有些时候不起作用.码:
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();
Run Code Online (Sandbox Code Playgroud)