Skip to main content

Posts

Showing posts with the label applitools

How to add Coded Ignore Regions dynamically in Applitools

There is a special feature in in Applitools Eyes that's called "coded ignore regions" to handle dynamic data. It's often used in Strict mode to increase test coverage if you don't want to switch to Layout mode. You can add coded ignore regions to the screenshot like this: target = target.ignore(By.id('reg1')).ignore(By.id('reg2')).ignore(By.id('reg3')); But what if these elements are created dynamically and you don't know how many of them will appear on the page? There could be 5 elements, or maybe 100... You cannot just add them in a chain by modifying a target like that. The answer is - you have to count them first and then add them in a loop. You can see the complete solution below for JavaScript.

Hiding a blinking caret (cursor) on the page with Webdriver and Javascript

When you use Applitools for testing, it is important to keep all pages in the same state as they used to be when the baseline Applitools screenshot was taken. In Applitools visual difference means a bug. This is why a blinking caret (cursor) can become a problem when the baseline screenshot was taken with a caret either visible or invisible, as long as the actual screenshot was captured with a different state of the caret. We can avoid this issue if we hide the caret by making it transparent before taking a screenshot in Applitools. This is how we can do it in Selenium Webdriver (Javascript bindings) (assuming that you initialized the driver object with Webdriver).