简体   繁体   English

如何使用 Selenium (python) 找到这个元素

[英]How to find this element using Selenium (python)

How to locate this element?如何定位这个元素?

在此处输入图像描述

<div _ngcontent-ysj-c5>
    <div _ngcontent-ysj-c5 class="list-items unselected"> == $0
        <!---->
        " Installation "
    </div>
</div>

i have tried我努力了

driver.find_elements_by_xpath("//[contains(text(),' Installation ')]"). 

& &

driver.find_element_by_xpath("//*[text()=' Installation ']").click();

but it doesn't work.但它不起作用。

How about this:这个怎么样:

driver.find_elements_by_xpath("//*[contains(.,'Installation')]")

or或者

driver.find_element_by_xpath("//*[.=' Installation ']")

=) =)

Try below locators:尝试以下定位器:

driver.find_elements_by_xpath("//div[text()='Installation']")

or或者

driver.find_elements_by_xpath("//div[normalize-space()='Installation']")

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM