Using the Selenium Highlight command with Cloud Testing

There is a little used but handy Selenium command called Highlight. It as you might have guessed highlights an element on a web page, which when combined with the screen-shot capabilities of Cloud Testing comes into it’s own.

The syntax is:

highlight(locator)
Arguments:

Briefly changes the backgroundColor of the specified element yellow. Useful for debugging.

To use this feature within Cloud Testing, just choose the Highlight command, and enter the element or link name e.g. ‘link=Click Me’ for the first argument.

highlight-results

To enable you to view the highlighted area, you will need to add a Capture Screenshot command as the next step in the script, as the highlighting is reset and removed on any page refreshes or reloads.

The area corresponding to the element is highlighted in yellow as can be seen in the following view:

highlighted

The following shows how you would highlight a text box on the screen.

highlight2-results

and a larger view of the highlighted element:

highlighted2

For more information on the Cloud Testing service and features, please visit the Cloud Testing website at www.cloudtesting.com

Did you enjoy this post? Why not subscribe to our feed and get articles like this delivered automatically to your feed reader.

Comments

[...] I can see why you might want to to highlight the locator elements in use at the time and error happens, if you take screenshots automatically when a test fails. And this is discussed by Phil Smith. [...]

Leave a comment

(required)

(required)