Selenium Grayed out Button

时间:2016-07-15 22:32:29

标签: python-2.7 selenium

您好我试图点击此按钮一直处于禁用状态,直到您填写其他字段。我正在使用firefox。我的脚本填写了这些字段,现在可以用鼠标点击按钮。但当我尝试通过硒点击该元素时,我收到错误

  WebDriverException: Message: Element is not clickable at point (281.8333282470703, 14.149993896484375). Other element would receive the click: <li ng-class="{active: $state.includes('urlAdm')}" id="adm-menu"></li>       

这是按钮的html。

   <div class="col-xs-offset-2 col-xs-5">
    <button type="submit" class="btn btn-primary ng-binding" ng-disabled="!userForm.$valid || user.deleted_at" disabled="disabled">
      <i class="fa fa-check-square-o fa-fw"></i>
      Create
    </button>
    <!-- ngIf: isAddUser() --><button ng-if="isAddUser()" type="button" class="btn btn-default ng-scope" ng-click="resetForm()">
      <i class="fa fa-eraser fa-fw"></i>
      Clear
    </button><!-- end ngIf: isAddUser() -->
    <!-- ngIf: !user.deleted_at && user.id !== currentUser.id && user.id -->
    <!-- ngIf: user.deleted_at -->
  </div>

我已经尝试定期点击按钮并通过操作完成但不起作用。

这是代码

    element = driver.find_element_by_xpath("//*[@id='user-editor-1']/form/div[5]/div/button[1]")
    ActionChains(driver).move_to_element(element).click().perform()

非常感谢任何帮助。谢谢!

1 个答案:

答案 0 :(得分:0)

您应该尝试click使用execute_script(),如下所示: -

element = driver.find_element_by_xpath("//button[contains(.,'Create')]")

driver.execute_script("arguments[0].click();",element)

希望它有帮助.... :)

相关问题