硒CSSSELECTOR用python编写的增加超时错误
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait as Wait
from selenium.webdriver.support import expected_conditions as EC
Wait(driver, 15).until(EC.presence_of_element_located((By.CSS_SELECTOR, 'td:nth-child(2)>input')))
driver.find_element(By.CSS_SELECTOR, 'td:nth-child(2)>input').send_keys(element[0])
搜索网站的CSS的部分HTML脚本
两个代码都无法正常工作。格式看起来正确。
也许CSS选择器似乎是问题所在?
之前,每次都有不同的输入时,ID属性每次都会更改
当此页面代码提高 timeOutExceptionError
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait as Wait
from selenium.webdriver.support import expected_conditions as EC
Wait(driver, 15).until(EC.presence_of_element_located((By.CSS_SELECTOR, 'td:nth-child(2)>input')))
driver.find_element(By.CSS_SELECTOR, 'td:nth-child(2)>input').send_keys(element[0])
The portion HTML script with CSS searched of the website
Both codes are not working. Format looks correct.
Maybe CSS Selector seems to be the problem?
The ID attribute changes every time when there is a different input prior to this page
Code raising a TimeoutExceptionError
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
语法上 css_selector :
是正确的,但仍然有合理的错误。
虽然以上 css_selector 第二
< td>
孩子,但是谁?在这种情况下,您必须提供一个由定位器策略首先,您必须提供一个唯一标识的参考节点 。例如:
关于
< table;
标签:相对于
< tbody class =“ z-row”>
tag:Syntactically the css_selector:
is correct but still have a logical error.
Though the above css_selector indicates immediate
<input>
descendant of second<td>
child, but of whom? In this case you have to provide a reference node uniquely identified by locator strategy first.As an example:
With respect to
<table>
tag:With respect to
<tbody class="z-row">
tag: