2017-01-12 51 views
0

我試圖自動化一個網頁,我無法識別靜態下拉。無法識別靜態下拉

<select name = "homeURL" tabIndex = "4" class = "storeId" >..</select>

我試着使用下述代碼中使用選擇類

Select dropdown = new Select(driver.findElement(By.name("homeURL"))); dropdown.selectByIndex(2);

我收到以下錯誤,以確定它:

Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to find element with name == homeURL (WARNING: The server did not provide any stacktrace information)

+0

退房http://stackoverflow.com/questions/30799545/selenium-web-driver-findelementby-name-and-headless-browser –

回答

0

這可能是一個各種不同的因素。比如網頁驅動程序,iframe,甚至頁面渲染需要多長時間。請考慮以下幾個環節:

網絡驅動程序:Selenium InternetExplorerDriver unable to find element that is clearly there

的Iframe: Selenium WebDriver: unable to locate element inside iframe using TinyMCE editor

頁面呈現的問題: Selenium Unable to Find Element

請考慮在看你的網絡驅動程序,硒的版本,已安裝的瀏覽器。

+0

謝謝。這是頁面呈現問題。 – Apoorve