click command in selenium webdriver does not work

前端 未结 9 1375
别跟我提以往
别跟我提以往 2020-12-13 09:08

I have just recently done an export of my selenium IDE code to selenium web driver. I have found that a lot of the commands that worked in IDE either fail to work or seleniu

相关标签:
9条回答
  • 2020-12-13 09:12

    This is a long standing issue with chromedriver(still present in 2020).

    In Chrome I changed from a zoom of 90% to 100% and that solved the problem. ref

    I find TheLifeOfSteve's answer more reliable.

    0 讨论(0)
  • 2020-12-13 09:13

    Please refer here https://code.google.com/p/selenium/issues/detail?id=6756 In crux

    Please open the system display settings and ensure that font size is set to 100% It worked surprisingly

    0 讨论(0)
  • 2020-12-13 09:13

    I was working with EasyRepro, and when I debugged my code it was clicking on the element which is visible and enabled, and not navigating as expected. But finally I understood the root cause for the issue.

    My Chrome was zoomed out 90%

    Once i reset the zoom level, it clicked on the correct element and successfully navigated to next page.

    0 讨论(0)
  • 2020-12-13 09:18

    There's nothing wrong with either version of your code. Whatever is causing this, that's not it.

    Have you triple checked your locator? Your element definitely has name=submit not id=submit?

    0 讨论(0)
  • 2020-12-13 09:22

    I was using firefox and some reason, it was not taking the click command though from past 2months it was working. My feeling was to make use of sendKeys and this page solved the problem. Now I am using sendKeys(Keys.Enter)

    0 讨论(0)
  • 2020-12-13 09:23

    Thanks for all the answers everyone! I have found a solution, turns out I didn't provide enough code in my question.

    The problem was NOT with the click() function after all, but instead related to cas authentication used with my project. In Selenium IDE my login test executed a "open" command to the following location,

    /cas/login?service=https%1F%8FAPPNAME%2FMOREURL%2Fj_spring_cas_security
    

    That worked. I exported the test to Selenium webdriver which naturally preserved that location. The command in Selenium Webdriver was,

    driver.get(baseUrl + "/cas/login?service=https%1A%2F%8FAPPNAME%2FMOREURL%2Fj_spring_cas_security");
    

    For reasons I have yet to understand the above failed. When I changed it to,

    driver.get(baseUrl + "MOREURL/");
    

    The click command suddenly started to work... I will edit this answer if I can figure out why exactly this is.

    Note: I obscured the URLs used above to protect my company's product.

    0 讨论(0)
提交回复
热议问题