Using Python bindings, Selenium WebDriver click() is not working sometimes.

后端 未结 7 1485
旧巷少年郎
旧巷少年郎 2021-02-02 12:27

I am trying to submit an input(type= button).But I am unable to update the value. Any help is appreciated. I have attached the testcase below for your reference.

7条回答
  •  暖寄归人
    2021-02-02 13:02

    I ran into the above issue where the same .click() is working in all browsers(IE, Chrome and Firefox) but not working for Safari. So I tried all the possible solutions from this post and none of them worked and it doesn't even throw error.

    I tried below by substituting .click() with .submit(), which is an equivalent method and it worked not only for Safari but also for all other browsers.

    So this:

    driver.find_element_by_id('login_btn').click()

    Replaced as:

    driver.find_element_by_id('login_btn').submit()

    If above fails to work on other browsers due to any reason keep .submit() in try and except. If it fails .click() will be triggered and executed.

    Hope this helps if none of the other solutions works.

提交回复
热议问题