简体   繁体   English

Selenium,Python - 试图点击 react-text 标签或点击它所属的类的第 n 次出现会导致错误“未找到元素”

[英]Selenium, Python - Trying to get to click the react-text tag or click the nth occurence of the class it belongs to leads to error 'no element found'

I tried我试过

driver.find_element_by_xpath('//span[@style="Text_in_style"]')

but gives error no such element.但给出错误没有这样的元素。 I know the 'list-group-item report-item' position i want is 13th out of the 20, so can i somehow the 13th class name 'list-group-item report-item'?我知道我想要的“list-group-item report-item”位置是 20 个中的第 13 个,所以我可以以某种方式使用第 13 个类名称“list-group-item report-item”吗? Thanks!谢谢!

As you can see both span style's have exactly similar structure below, only except for the span style正如您所看到的,两种 span 样式在下面具有完全相似的结构,只是 span 样式除外

buttons = driver.find_elements_by_xpath('//*[@class="list-group report-group-list"]')
buttons[3].click()

Thanks!谢谢! google谷歌

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 python selenium点击第n个元素 - python selenium click nth element 尝试单击“a”标签时出错 - Selenium Python - Error When Trying to Click on an `a` Tag - Selenium Python 属于特定类的Python Selenium单击按钮 - Python Selenium click button that belongs in a specific class EC.presence_of_element_located not和WebDriverWait导致“selenium for Python中的其他元素将收到点击:...”错误 - EC.presence_of_element_located not and WebDriverWait leads to “Other element would receive the click: …” error in selenium for Python Python中的Selenium,无法单击“按钮”:找不到标记 - Selenium in Python, Unable to Click 'button': Tag not found 单击找到的第二个元素 - Selenium Python - Click on second element found - Selenium Python 找到Python Selenium Webdriver元素,但无法单击它 - Python Selenium Webdriver element found but can not click on it </a></i>无法单击<a>带有<i class>selenium python</i>的</a>标签 - Cannot click tag <a> with <i class> selenium python [Python][Selenium] “.find_element_by_class_name.click()”上的错误 - [Python][Selenium] Error on “.find_element_by_class_name.click()” selenium.common.exceptions.ElementNotVisibleException:消息:尝试使用Selenium Python单击元素时出现元素无法交互错误 - selenium.common.exceptions.ElementNotVisibleException: Message: element not interactable error when trying to click an element using Selenium Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM