How to make clicking more robust in web testing?
The specific tool I am using is Oracle Openscript, part of the Oracle ATS package. However, their web-based component uses xpath-based object identification, so it has a lot in common with other, more popular tools.
The problem I'm having is that after recording a series of navigation clicks on heavily-styled elements (for example,
elements styled to look like buttons using jQuery), a simple playback fails to click on them. It turns the correct element pink, which I believe is OpenScript's way of identifying what it's trying to click, but then times out unless I manually click it. Clearly the click event is failing.
I know record and playback is immensely fragile, so I'm trying to build a library of helper functions I can use to build tests in the future. What methods generally do people use to combat fragility of click methods in tools? Surely there's a better way than just trying in a loop until navigation changes?
If this were Selenium, what I would do is first wait for the element to exist before I tried to operate on it (especially if I'm seeing this problem on IE, seems to be a common annoyance with that browser unfortunately)
Rereading your question, I think something like this will solve it. That you can click it manually after the tool loads the page and fails to execute the same click indicates a likely race condition.
I think there is a way to do this with OpenScript, according to this oracle doc, by setting a separate wait for a particular object like the anchor tag.
Expand the Object Timeout group and set the preferences as follows: Timeout(S): Specifies the maximum number of seconds OpenScript should wait for an object to appear before considering the object not found. This is the default timeout when waiting for an object to appear before invoking an action against it. This is also the default timeout when waiting for an object to appear before continuing the script. You can override individual object wait timeouts in waitForPage() or object.waitFor() by editing their "timeout" properties. Action timeouts cannot be overridden.