[英]How to find the value of all the id attribute of all the button elements in a web page using Selenium
[英]Find all elements with onclick attribute using selenium?
我正在尝试使用xpath
和一个onclick
attribute
来find_elements
。
示例元素:
< a
href = "#"
onclick = "javascript:ValidateLink("FNOSquareOffBuySell","NATMIN,NFO,8503107736,S,6000,0,30-Aug-2018,E,11500,C,O,S,E,*,35,0,0,0,0,0,,,0,118.85,0,,,*,*,,NVTC")" >
Square & nbsp;
Off < / a >
如果我可以在Square & nbsp; Off
的find命令中进一步过滤它,那将是一个好处Square & nbsp; Off
Square & nbsp; Off
我努力了:
ch = driver.find_elements_by_xpath("//*contains(@onclick,\"FNOSquareOffBuySell"\")]")
ch = driver.find_elements_by_xpath("//*[contains(@onclick)]")
我想找到元素,然后获取onclick属性文本,并使用它来确定要单击的元素。
您是否尝试//*[@onclick]
查找所有onclick元素?
同样,您为"//*contains(@onclick,\\"FNOSquareOffBuySell"\\")]"
,您的意思是//*[contains(@onclick,\\"FNOSquareOffBuySell"\\")]
要么
//*contains(@onclick,'FNOSquareOffBuySell"')]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.