I missed highlighting object feature of QTP when I used to debug my selenium API call on webelement. Number of times I wondered, why didn’t by default any method is provided to perform highlight action. But I no longer wish for the same as I have found work around.
Logic to perform highlight
WebElement in Selenium WebDriver:-
To create highlight effect, as in QTP, we don’t just need to highlight the element but also have to de-emphasize/play down the same element. Highlighting element once is not enough, as the operation would be fast and we may don’t realize highlighting effect. Better we break down logic as in below steps:-
- Perform above two actions in a loop for significant time.
As you can see in the above code, method highlightElement accepts WebElement as parameter and perform highlight operations for 5 seconds [i<5].
This is all for now.