0
votes

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)?

3
Please provide link to the page, or a similar one, or relevant HTML. Also, please provide relevant Ruby code.Željko Filipin

3 Answers

0
votes

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.

0
votes

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
0
votes

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.