如何查找”此按钮带有硒?
我想用Selenium在我的WebDriver窗口中单击此按钮。大多数时候,我都在使用Find_element_by_id,但是如何找到这个呢?
<button role="button" data-testid="uc-accept-all-button" class="sc-gsDKAQ cYtWkK" style="margin: 4px 0px;">accept all</button>
尝试了XPath,名称和班级已经像以下
driver.findElement(By.xpath("//*[text()='accept all']")).click()
driver.find_element_by_class_name("sc-gsDKAQ cYtWkK").click()
i´d like to click this button in my webdriver window with selenium. Most of the time i am using find_element_by_id, but how can I locate this one?
<button role="button" data-testid="uc-accept-all-button" class="sc-gsDKAQ cYtWkK" style="margin: 4px 0px;">accept all</button>
Tried xpath, name and class already like below
driver.findElement(By.xpath("//*[text()='accept all']")).click()
driver.find_element_by_class_name("sc-gsDKAQ cYtWkK").click()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会选择这样做:
用于硒的使用:(未测试但应起作用)
I would go with this:
For use by Selenium: (not tested but should work)