How To Highlight Element Using Selenium WebDriver

Let’s see how to highlight element using Selenium WebDriver in this post. We need to write a few lines of code to highlight element using Selenium WebDriver. If you have an idea on QTP, you would remember the highlight method in QTP which is an inbuilt feature. Coming to selenium we need to get the help of JavascriptExecutor interface to achieve this.

Earlier I have posted a detailed post on JavascriptExecutor in Selenium. Check the below link for the same.

JavascriptExecutor in Selenium WebDriver

Let’s make the above code as a function. So whenever we want to highlight particular element, we could use this method to achieve our goal.

If you are not regular reader of my blog then I highly recommend you to signup for the free email newsletter using the below link.

Rajkumar SM is a founder of SoftwareTestingMaterial. He is a certified Software Test Engineer by profession and blogger & youtuber by choice. He has an extensive experience in the field of Software Testing. He writes here about Software Testing which includes both Manual and Automation Testing. He loves to be with his wife and cute little kid 'Freedom'.

Leave a Comment

Share via
Copy link
Powered by Social Snap