-1
好,这种说法是给我的错误:硒的webdriver无法找到元素,这显然是有
new Select(driver.findElement(By.id("870"))).selectByVisibleText(reason);
org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"870"}
命令持续时间或超时:1.02秒
我试图与XPath找到它,和身份证,我知道它的身份证号码870.我曾尝试在睡觉,以确保它也加载。
在此先感谢。
我正在使用版本2.5与Firefox。
元素
<select id="870" class="ui-widget-content reactor alias_reason" data-bind="options: questionValueGroup.questionValues, optionsText: 'qu…: properties(), setSingleSelected: $parent.providerAnswers()" paid="37" group="6" style="background-color: #FCFDFD;"></select>
编辑2:我想通了的家伙,我只是用铬合金的XPath选择工具,它给了我一个不同的XPath的作品。
分享有问题的元素的HTML。 – Amey
抛出'NoSuchElementException'时,通常由于两个原因。 1.元素位于框架或iframe中,在这种情况下,您需要使用'switchTo.frame(“frame_identifier”)“或2.元素加载速度较慢,您需要等待元素加载。 – Richard
什么浏览器?该浏览器的哪个版本?什么版本的Selenium? – Arran