WPath and Images

For more general information about the WPath please read the WPath page.

 

In many situations, images (pictograms) are used instead of text.

<button id="addToCart" title='Add to cart'>
  <img src='shopping_cart.png' width='26' height='26' alt='shopping cart' />
</button>

Wetator is not able to understand the meaning of the image, you have to use a different way to address this.

Option 1: the 'alt' attribute

It is good practice for web applications to assign a dedicated alt attribute to every image to make the page accessible in terms of barrier-free design.
Because Wetator is blind (in terms of understanding the image), you can use the value of the alt attribute in the WPath for pointing to that image.

Command Parameter Optional Parameter
click-on shopping cart

Option 2: the 'title' attribute

Most browsers display the value of the title attribute of an image as tool-tip if you stay with mouse over the image for a certain amount of time.
Because the tool-tip should somehow explain the image, you can use the value of the title attribute in the WPath for pointing to that image.

Command Parameter Optional Parameter
click-on Add to cart

Option 3: the image file name / the 'src' attribute

Command Parameter Optional Parameter
click-on shopping_cart.png

Option 4: the image 'id'

Using the ID for addressing controls is more of a fallback than a solution. It is possible though.
Please keep in mind to keep your tests stable, readable and maintainable. With these paradigms in mind addressing controls by ID does not seem to be a good idea in most cases.

Command Parameter Optional Parameter
click-on addToCart