【发布时间】:2020-06-03 23:48:19
【问题描述】:
我在使用 selenium 点击按钮时遇到了困难。似乎无法弄清楚我做错了什么
self.driver.find_element(By.XPATH, "//button[contains(text(), 'Call Me ')]").click()
编辑: 所以认为问题是根据 https://sqa.stackexchange.com/questions/36918/xpath-text-buy-now-is-working-but-not-containstext-buy-now
但是,我的新功能仍然无法定位元素
//button[contains(.,'Call Me')]
感谢到目前为止的帮助。
下面是我要访问的按钮的 HTML 代码。
<div id="auth_methods">
<fieldset data-device-index="phone1" class="">
<h2 class="medium-or-larger auth-method-header">
Choose an authentication method
</h2>
<div class="row-label push-label">
<input type="hidden" name="factor" value="Duo Push">
<span class="label factor-label">
<i class="icon-smartphone-check"></i>
Duo Push
<small class="recommended">
Recommended
</small>
</span>
<button tabindex="2" type="submit" class="positive auth-button"><!-- -->Send Me a Push </button>
</div>
<div class="row-label phone-label">
<input type="hidden" name="factor" value="Phone Call">
<span class="label factor-label">
<i class="icon-call-ringing" alt="" role="presentation"></i>
Call Me
</span>
<button tabindex="2" type="submit" class="positive auth-button"><!-- -->Call Me </button>
</div>
【问题讨论】:
标签: python python-3.x selenium selenium-webdriver multi-factor-authentication