0

I'm using Watir-Webdriver to do automation testing. But it seem not stable for cross browser. For example, it usually work fine in Firefox and Chrome but are not stable in IE. When I get an element and do a click, in ie7,8,9 it response in a different ways. The button can be clicked but nothings happen. I've tried many ways like: click, click(), send_key, fire_event but I still haven't got the final solution for cross browser clicking. For example, in ie9, when using click, sometime it works perfect, sometimes not, I don't know the reason.

Do we have a solution such as a function allow we to click successful in an element in multiple browsers (especially in IE7,8,9)?

ndh103
  • 96
  • 1
  • 6

3 Answers3

0

I think IE uses a different method for "click" than other browsers. As a result it's unpredictable unless it has uninterrupted focus. An alternative may be to use Watir Classic specifically for IE, as that uses the COM object rather than Javascript.

Virtuoso
  • 908
  • 1
  • 8
  • 14
  • It could be that, or it could simply be browser speed. the Javascript engine in IE9, current Chrome and Firefox is pretty dammed fast.. Older versions of firefox (really old) or IE8 and below are very slow. If the page has a lot of JS rendered content, or Ajax'y type stuff, it could be that the script is trying to proceed while the page is still doing client side JS stuff (Note that the browser reports it is 'done loading' when it has all the files in the basic page, and javascript stuff can still be happening after that is the case.. – Chuck van der Linden Feb 26 '13 at 21:42
0

Try using the .when_present decorator, to ensure that you are not trying to click something that is not in a state ready to be clicked.. sometimes useful for slower browsers like older flavors of IE.

browser.link(:id => "foo").when_present.click
Chuck van der Linden
  • 6,660
  • 2
  • 28
  • 43
0

You might also be running across this issue that I posted a while ago: Watir Webdriver in IE8, click link, event seems to keep firing for ever

Does the click in IE work the first time you use it in a new session, then never work again in that session? That would suggest to me that this is the same issue as I had.

Community
  • 1
  • 1
russthegibbon
  • 303
  • 2
  • 8