In order to write dynamic XPath in a Selenium WebDriver. First of all, you should have a firefox browser with firebug and fire path installed the plugin.
First of all, after the installation, press F12 to view this plugin.
Now follow below-mentioned steps:-
Select XPath after Click on fire path and.
After that open any website and inspect web element - you will get XPath of that element in fire path.
In XPath, you can view id, class, visible text. Inspect element location properly.
Now create your own XPath based on the unique ID of web element.
If you want to learn Selenium you must enrol in the Intellipaat’s Selenium Training Course. You should also watch the following Selenium video tutorial. .