![](/img/trans.png)
[英]Python selenium - How would I be able to click on all the buttons on the screen with certain values
[英]Selenium in Python - how do I click all buttons with a certain label?
所以我想用按鈕 label "CLAIM" 單擊所有按鈕,但是它不起作用。 這個 label 有多個按鈕,所以我試着做這個:
like = driver.find_elements_by_class_name('CLAIM')
for x in range(0,len(like)):
if like[x].is_displayed():
like[x].click()
按鈕:
<div class="label">CLAIM</div>
我試過使用 xpath,但是這個 label 有多個按鈕。 誰能幫忙
只需找到帶有 class label 和文本 CLAIM 的 div 並遍歷它們。
likes = driver.find_elements_by_xpath("//div[@class='label' and .='CLAIM']")
for like in likes:
like.click()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.