我正试图解决这个问题:
<label class='blah' style='bbb'>
<input class='input_trello klaus black_mage' type='mail' place-holder='placeIt' name='name' id='myid'>
我需要的是使用Selenium在输入中写入,每次我尝试将其作为Xpath,id或名称,它无法在HTML中找到它。
selenium.common.exceptions.NoSuchElementException: Message: no such
element: Unable to locate element: {"method":"id","selector":"myid"}
尝试xpath:
selenium.common.exceptions.NoSuchElementException: Message: no such
element: Unable to locate element: {"method":"xpath","selector":"//*[@id="myid"]"}
有人在这黑暗中给我一个亮点吗?
答案 0 :(得分:1)
正如@Tbaker所说,只需输入一个隐含的等待它的值:
driver.manage()。timeouts()。implicitlyWait( 10 ,TimeUnit.SECONDS);
等到HTML加载,现在它在到达新页面后会完美运行。