无法使用Selenium-python单击按钮
我在使用selenium单击按钮时遇到困难。似乎不知道我做错了什么无法使用Selenium-python单击按钮,python,python-3.x,selenium,selenium-webdriver,multi-factor-authentication,Python,Python 3.x,Selenium,Selenium Webdriver,Multi Factor Authentication,我在使用selenium单击按钮时遇到困难。似乎不知道我做错了什么 self.driver.find_元素(By.XPATH,“//按钮[包含(text(),'Call Me')])。单击() 编辑: 因此,我认为问题在于xpath的 但是,我的新函数仍然无法定位元素 //按钮[包含(,'Call Me')] 谢谢你迄今为止的帮助 下面是我试图访问的按钮的HTML代码 <div id="auth_methods"> <fieldset data-device-index="
self.driver.find_元素(By.XPATH,“//按钮[包含(text(),'Call Me')])。单击()
编辑:
因此,我认为问题在于xpath的
但是,我的新函数仍然无法定位元素
//按钮[包含(,'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>
选择一种身份验证方法
双推
推荐
推我一下
打电话给我
打电话给我
我也遇到了同样的问题,我尝试了以下方法:
path = 'your xpath'
button = driver.find_element_by_xpath(path)
button.Click()
这对我来说很管用