英文:
Invoke a page by onclick() event using webdriver(selenium)
问题
我想使用网络驱动程序(selenium)根据onclick
事件调用页面。
<img src="active.png" class="default-logo avatar-image" onclick="custom(event)">
所以有人可以帮我解决这个问题,将会很棒。
提前谢谢!
英文:
I want to invoke the page based on the onclick
event using a web driver(selenium).
<img src="active.png" class="default-logo avatar-image" onclick="custom(event)">
So can anybody help me with the solution it will be great.
Thanks ahead!
答案1
得分: 0
这里有一个示例作为范例:
driver.find_element_by_css_selector("img[onclick*=custom(event)]").click();
通过这种方式,您将会找到一个具有 onclick 属性,且属性值 包含(这就是 *= 的意思)custom(event) 的 img 元素类型。
英文:
Here is a sample as an example:
driver.find_element_by_css_selector("img[onclick*=custom(event)]").click();
In this way, you will find an element type of img that has onclick attribute that contains (this is what *= means) this: custom(event).
专注分享java语言的经验与见解,让所有开发者获益!
评论