Selenium 和 Python 单击带有文本的按钮

问题描述 投票:0回答:1

我尝试了很多方法,但我一辈子都无法点击这个按钮!

这是我目前的尝试。有人可以帮我指出我缺少什么吗?

driver.find_element(By.XPATH, '//button[@class="btn regular-button main-button regular-main-button submit progress-state still"]').click()

<button type="button" class="btn regular-button main-button regular-main-button submit progress-state still" onclick="javascript: this.form.submit();">
  
  <div class="caption">
    <span>Start Import</span>
  </div>
  <div class="loader">
    <div class="dot dot1"></div>
    <div class="dot dot2"></div>
    <div class="dot dot3"></div>
  </div>
  <div class="success">
    <i class="fa fa-check"></i>
  </div>
  <div class="fail">
    <i class="fa fa-exclamation"></i>
  </div>
</button>
python selenium-webdriver
1个回答
0
投票

尝试使用 JavaScript 执行器提交或点击。

element = driver.find_elements_by_class_name("btn regular-button main-button regular-main-button submit progress-state still")
    
driver.execute_script("arguments[0].click();", element)
© www.soinside.com 2019 - 2024. All rights reserved.