位於元素的存在我的下面的代碼工作正常,但現在,我得到超時響應。我不確定如何處理這個超時問題 - 請告知。超時30秒後,等待
public void Browse_Samsung() throws Exception
{
WebDriverWait wait = new WebDriverWait(driver, 30);
Actions act = new Actions(driver);
act.moveToElement(Digital_Menu).perform();
act.click(wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='CategoryMenu1']//a[@title='Samsung']")))).build().perform();
WebElement Micromax = wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id='filter_1Option_21']//a[@title='GSM Mobile Phones - Micromax']")));
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("arguments[0].scrollIntoView(true);arguments[0].click()", Micromax);
}
}
場景:
- 登錄www.homeshop18.com
- 從左邊 顯示在 「品牌」 一節 「數字」 菜單現在
- 選擇 「三星」我需要SCROLL並選擇另一個名爲「Micromax」的品牌。
Error: org.openqa.selenium.TimeoutException: Timed out after 30 seconds waiting for presence of element located by: By.xpath: //*[@id='filter_1Option_21']//a[@title='GSM Mobile Phones - Micromax']
檢查單擊如果所有的定位器仍然有效。 – Guy