如何在标签内找到输入? - Python Selenium

时间:2016-02-25 19:23:32

标签: python html selenium xpath

我正试图解决这个问题:

<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"]"}

有人在这黑暗中给我一个亮点吗?

1 个答案:

答案 0 :(得分:1)

正如@Tbaker所说,只需输入一个隐含的等待它的值:

  

driver.manage()。timeouts()。implicitlyWait( 10 ,TimeUnit.SECONDS);

等到HTML加载,现在它在到达新页面后会完美运行。