Any web element

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
Dominik
Posts: 1
Joined: Tue Jan 12, 2016 10:00 am

Any web element

Post by Dominik » Tue Jan 12, 2016 10:06 am

Dear ranorex team,
I have problem with defining any web element xpath.
I have element specified by attribute value //*[@class~'someContent'] but when trying to run tests, I have following error:

Argument 1: cannot convert from 'Ranorex.Unknown' to 'Ranorex.WebElement' (CS1503) - C:\RanorexTests\Project\Litecom\LitecomLib\Pages\LitecomGenralPages\ElementTreePage.cs:231,23

Problem is, I need to define element only by it's attribute value, because html element change in time: there can be span or div.

Fergal
Certified Professional
Certified Professional
Posts: 455
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Re: Any web element

Post by Fergal » Wed Jan 13, 2016 2:45 pm

Do your web elements have unique IDs? If so, you can use those IDs to uniquely identify your elements, in the XPath.

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Any web element

Post by krstcs » Wed Jan 13, 2016 8:33 pm

Use 'webelement' instead of '*' as the element type in the XPath.

//webelement[@class~'someContent']

http://www.ranorex.com/Documentation/Ranorex/
Shortcuts usually aren't...