html代码片段如下:
<thead id="addDet:cust:th" class="emp">
<tr id="addDet:cust:ch" class="emp">
<th class="emp" scope="col" id="addDet:cust:ch:j_idt484">S. No.</th>
<th class="emp" scope="col" id="addDet:cust:ch:j_idt487">Name
<font color="#FA5882">*</font></th>我试着填补这个领域,因为:
driver.find_element_by_id("addDet:cust:j_idt487").send_keys("XX")但我得到的错误是:
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"id","selector":"psdetail:j_idt490"}任何帮助都是有价值的。
发布于 2015-06-17 15:17:01
你的代码中有错误。你把:ch:忘在:cust:之后了。
发布于 2015-06-17 15:32:14
在修复了选择器(Imcphers应答/注释)之后,当您试图查找元素时,元素是否可能不在DOM中?它是动态加载的吗?如果是这样的话,您可能需要使用explicit或implicit等待。
advanced.jsp
初始化驱动程序后尝试driver.implicitly_wait(10)
发布于 2015-06-17 15:49:27
尝试使用xpath contains或CSS以//xpath开头//*CSS(.,‘S.No.’)“
https://stackoverflow.com/questions/30895656
复制相似问题