如何通过Selenium内部的文本查找带有按钮的按钮(Python)? [英] How to find button with Selenium by its text inside (Python)?
本文介绍了如何通过Selenium内部的文本查找带有按钮的按钮(Python)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下三个按钮,我无法弄清楚如何获取其中的文本(例如,异常值).我尝试了browser.find_element_by_link_text("Outliers").click()
,但收到无法找到元素"错误.我该怎么办?
I have the following three buttons that I can't figure out how to grab the text that is inside of them (e.g Outliers). I tried browser.find_element_by_link_text("Outliers").click()
, but got "Unable to locate element" error. How can I do it?
推荐答案
另一个示例XPath:
Another example XPath:
browser.find_element_by_xpath('//button[text()="Outliers"]')
这篇关于如何通过Selenium内部的文本查找带有按钮的按钮(Python)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文