1

In some cases i see the "Click Element" keyword had click on the element but the action on that element in not triggered. When I say "keyword had clicked on element", it means it did not throw any error and in some cases I can see the dotted border around the element which normally happens when we click on element. Has anyone encountered such kind of problem?

::My Questions::

  1. Can it happen that selenium misses the click
  2. I have put the waits for that element to be visible & enable. Assuming a possibility that corresponding JS is not loaded, in this case it should throw error which is not happening. I am capturing details via BrowserMobProxy which does not show any JS error.

I am clueless why this is happening

Few observation: - Whenever the environment is slow, this tend to happen more - We tried adding consecutive clicks for same element (with "Run Keyword And Ignore Error" with second "click element") and it worked.

Big help if someone can provide the work around.

Vinaykumar Patel
  • 864
  • 11
  • 26
  • have you tried using a step to wait for the page to be loaded? – lauda Jul 20 '16 at 10:31
  • If the webdriver is using native events (on for IE, optional for FF), there is always a chance that the element moves just before the event is triggered, but I believe it to be pretty rare. Maybe your event handler is registering some time after the element is rendered and enabled. That would explain why its worse when the env is slow. Perhaps you should talk to the dev team about this. Sleeps would probably fix the problem but are of course undesirable. – ombre42 Jul 20 '16 at 13:57
  • @lauda, There is no such keyword in robotframework "Wait for Page to Load". But I have "wait until element is visible" which is working fine. – Vinaykumar Patel Jul 21 '16 at 14:46
  • @ombre42 . Considering the possibility that event handler registers the even bit late, what the options left for developer. Can be be fixed via coding as this is happening with multiple component. – Vinaykumar Patel Jul 21 '16 at 14:48
  • I said using a step to, not using the step, glad it worked, if you need such a step to wait for the page to be loaded maybe you will add one. – lauda Jul 21 '16 at 14:52
  • @VinaykumarPatel - not sure. for some frameworks, there is a way to hook in and "know" when the framework is busy and when its done. talk to the devs. – ombre42 Jul 21 '16 at 19:00

2 Answers2

0

Have you tried using:

Wait Until Keyword Succeeds 

The above should be useful if you anchor it with an action that you know will happen at the end of the page load. So for example we have a widget that loads only after an external API call succeeds. Therefore if I use the above with the page containing that widget, I know the next action will succeed

shicky
  • 2,076
  • 5
  • 30
  • 44
  • But don't user Click Element after the above keyword, use something else such as a javascript widget – shicky Jul 22 '16 at 09:08
  • But don't use Click Element after the above keyword, use something else such as Page Should Contain a javascript widget – shicky Jul 22 '16 at 09:16
  • Not sure what did you mean by "Page should contain a JS Widget"? Should I wait for certain JS to load. Each page has different JS and there are many. Besides, not sure how this will solve the problem? – Vinaykumar Patel Jul 25 '16 at 04:00
  • Basically you want to set Page should contain to one of the items that will load LAST on screen. Therefore when it has loaded, you know it'll be possible to click the element you want to click – shicky Jul 25 '16 at 08:50
0

You can find here a post related to wait. You can create a new step with a conditional wait seconds and check for ajax and/or the document ready state.

Community
  • 1
  • 1
lauda
  • 4,153
  • 2
  • 14
  • 28
  • I checked the post which says why there is no need of keyword wait until page is loaded". Which mean my current waits (Wait Until Element is visible) should work as the element is present on the screen. So element is there, and from the observation I can say selenium is clicking on the element and still the action is not triggered and there is no JS error. Problem is not resolved yet. – Vinaykumar Patel Jul 25 '16 at 03:58