I have the following HTML code where I need to detect the number of records displayed on the page and select the correct record. However, inspecting the elements with Firefox show the records are having the same class name while the id of the WebElement is dynamically created.
If I use it to locate by tag name, it will return more than 100 Web elements.
May I know how do I identify use XPath or CSS selector to obtain the first record displayed on the page.
WebElement menuList = driver.findElement(By.cssSelector(".scrollable-content"));
List<WebElement> search_li = menuList.findElements(By.tagName("div"));
WebElement searchresult = driver.findElement(By.ByXPath.className("grid-view-drop-area ng-star-inserted"));
searchresult.click();