TestProject Forum

iOS - Unable to return the attribute value though the XPath is valid

Hi Team,

I need assistance in resolving this issue.
I have written dynamic Xpath like “//xcuielementtypetextfield[contains(@name, ‘Email’)]//following-sibling::XCUIElementTypeOther” and locate the element properly while recording but if I try to return the attribute value then I get error as “An element could not be located on the page using the given search parameters.”

Thanks in advance.

Sunil Gowdru C

Technically it should work in this way:

Example : //[@class=’col-md-6 text-left’]/child::div[2]//[@class=’panel-body’]//following-sibling::li

I also shared this here: Xpath in selenium