In the screen how to navigate to the row which contains the text that needs to be Edited and then click on Edit button.
Scenario: I have a screen where I need to find the row which has the value as "test", then click on the Edit button of that row and then edit the value and remark column in that row and save... I have taken the xpath by position of the value "test" in the screen but this cannot work bz if the user enters a new value and the position of the value "test" changes then it will not click on the edit button . Similarly I have also taken the position of the field - value and remark... Below is the Code: 1)//*[@id='mainForm:propertiesTable_data']/tr/td/following::a/span[contains(@class,'ui-icon-pencil')] …. This is the Xpath of the Edit button which has the value "test" which is in the 47th position in the table 2)Iam clicking on the above path with this code - PageUtil.clickOnButton(driver, AppXPathsConstants.PropertiesEditIcon); 3)WebElement Value = driver.findElement(By.xpath(("(//input[contains(@class,'ui-inputfield') and @role='textbox'])")));--------------> This is the xPATH OF THE FIELD VALUE which is in the 93rd position 4)So iam clicking on the field,moving to the cursor to the left side of the text box by using Home button and then entering the value for the field which is read from the Feature file: Value.click(); Value.sendKeys(Keys.HOME); DriverUtil.waitTime(1000); PageUtil.clearInputElement(Value); PageUtil.inputFieldEntry(driver,AppXPathsConstants.PropertiesValue,formEntryMap.get("Value"));
Now since the position of the field test can change when some other text is entered so it is not the right way of taking the Xpath and Editing and adding the text ….can some one please tell me how to go with this. Thanks in advance