[英]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.