When i am try to get different values from same class name then getting only first value from every time
String app = WebUI.getText(findTestObject(‘Object Repository/ResearchAndDevelopment/Page_Search Result/p_Appelant’),FailureHandling.OPTIONAL)
String res = WebUI.getText(findTestObject(‘Object Repository/ResearchAndDevelopment/Page_Search Result/p_Respondant’),FailureHandling.OPTIONAL
When the locator (XPath possiblly) of the Test object Object Repository/ResearchAndDevelopment/Page_Search Result/p_Appelant
potentially selects 2 or more HTML element, then the WebUI.getText()
keyword will always select the 1st HTML element and return its text. The keyword is designed as such.
Possibly, you want to create 2 Test Object which locator similar to the current Object Repository/ResearchAndDevelopment/Page_Search Result/p_Appelant
. And you should edit the XPath of 1st Test Object and 2nd Test Object; each XPath should specifically seleft the “1st element”
and “2nd element”.
Alternative approach is to use:
This keyword will return a List of WebElements
. Out of the result List, you can get access to all of contituting WebElement
instances.
How to work with WebElement
objects? ---- read the doc, and do search Google for that question first.
Thanks @kazurayam ! Already i had resolved this issues by using different xpath for each testobject.