My Scenario : I have a Table as seen in the below screen shot where there is a Search Demand box. I have a method which fetches the LatestDemand Id and then enters the Demand Id in the Search box and then i click on the checkbox to select the Demand Id .Then i Clear the Demand Id that is entered in the Search Demand text box and my next requirement is to fetch the next Id from the table. Any Leads
The Issue is it Fetches the Lastest Id which is 4251 and clicks on the checkbox but iam not able to fetch the other Id which is 4152.
Below is the Code to Fetch the Id : The first time it fetches the id the second time it is not fetching the Id ... public static HashMap<String, String> createdValue; public static void FetchID(WebDriver driver) throws InterruptedException{ createdValue = new HashMap<String, String>(); List<WebElement> tableValues = driver.findElements(By.xpath("//table//tr//td[contains(@class,'mat-column-demandId')]//span")); int tableValueSize = tableValues.size(); for(int i =0;i<tableValueSize;i++){ WebElement latestId = driver.findElement(By.xpath("(//table//tr//td[contains(@class,'mat-column-demandId')]//span)["+ tableValueSize +"]")); createdValue.put("latestDataId", latestId.getText()); System.out.println(createdValue.put("latestDataId", latestId.getText())); inputEntry(driver, AppXPathsConstants.SearchInputXpath , createdValue.put("latestDataId", latestId.getText())); clickOnElement(driver, AppXPathsConstants.PlanningcheckboxselectionXpath); WebElement SearchinputElem = driver.findElement(By.xpath("//input[contains(@class,'search-class')]")); clearInputElement(SearchinputElem); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)