英文:
Check Span Element with ID for text in Selenium/Python
问题
driver.find_element(By.XPATH, '//span[text()="Derzeit nicht verfügbar"]')
英文:
I want to refresh a page until a certain text changes. However, both texts are permanently present several times on the page.
So I need to check a span element with an ID and a specific text at the same time.
Can someone tell me how to do this with driver.find_element(By.XPATH,)
?
Thanks and greetings
Jannis
driver.find_element(By.XPATH,'//span[text()="Derzeit nicht verfügbar"]')
答案1
得分: 1
//span[@id='example' and text()='Hello World!']
should work for you here.
英文:
//span[@id='example' and text()='Hello World!']
should work for you here.
答案2
得分: 0
你的XPATH需要一个AND运算符。
这是语法:
//tag_name[@name = 'Name value' and @id = 'ID value']
因此,你可以构建你的XPATH如下所示:
//span[text()="Derzeit nicht verfügbar" and @id="enter id value here"]
英文:
You need an AND operator in your XPATH.
This is the syntax:
//tag_name[@name = 'Name value' and @id = ‘ID value’]
So you can construct your XPATH something like below:
//span[text()="Derzeit nicht verfügbar" and @id="enter id value here"]
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论