How To Handle Dynamic Search - Using Dynamic XPath In selenium web driver

Опубликовано: 04 Октябрь 2024
на канале: KB Tutorials
4,054
42

In this tutorial we will see how to perform dynamic search using Selenium web Driver

For example i am taking tsrtc(https://tsrtconline.in/oprs-web/) site .here if you type from place few characters it will gives you the suggestions bar from suggestions bar we need to select the from place. I have automated this scenario using selenium web driver.

First we need to identify the from place web element ,then using sendKeys in selenium we need to enter data (in our case I am sending "Banga") after half second it will gives you the suggestion bar.
With findElements we can get the list of elements in suggestion bar,using for loop and getText() in selenium web driver we can get all the elemenents .Using simple if else condition we can desired element .