Get Free Audit

Automating Magento Testing Process. Speeding Up the Search for Elements

May 3, 2013

1123 Vikentsi Kaziuk

Automating Magento Testing Process. Speeding Up the Search for Elements

As we stated in the previous article, in most cases it is impossible to make search in the admin panel using the ID parameter, so instead we have to frequently use the Xpath locators to effectively use the automation. But in this case along with losing the flexibility we also encounter another problem – it significantly increases the time to search and find an element and, therefore, the time to execute tests. This is not so noticeable if you are trying to automate acceptance tests only. But if you need to automate the complete project, the speed of the test execution increases enormously.

A possible solution would be to use the standard method Selenium – аssignId


It temporarily assigns a specified identifier to an element. So later, before reloading the page, you can access this element directly through this identifier, not through the slow and cumbersome Xpath locator.

This method can be useful, for example, when elements are added on the page via аjаx without reloading the page. As seen on the picture below, elements are added via the Add Exception button without reloading the page and the element has a generated Id, which makes us to use the Xpath locator.

1

Therefore, we need to access the buttons “Delete” and “Add Exception” through the assigned identifier.

2

Here is an example of a test, which uses such method:

Igor Dragun
Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Igor


Magento Audit

Magento Audit

Take your online store to the next level with BelVG Magento audit

Visit the page

It is also necessary to use the аssignId method in case you expect a page element with a generated Id to appear. This happens due to the fact that cycle is repeatedly searching for one and the same element, thus, before starting the cycle, assign first the identifier to an element via the method аssignId, and then access it directly in the cycle. This is how it looks:


Another time-consuming procedure during the test execution is filling of the multiselect tag.  It is also possible to speed it up using the аssignId method.


These are just some examples of possible assigning an Id to a page element. Use the аssignId method where it is necessary and you’ll see significant advances in your test performance optimization.

Looking for a reliable Magento support partner? Turn to BelVG!

Igor Dragun
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Igor

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *