Object spy shows that all of my elements have tags, so I’m a bit baffled. Does getAttribute not work for all the attributes displayed in the object repository? Is there a different way to get the tag within a script?
Thanks for any help! (and please consider me a newb in your replies)
text is (almost) never an attribute of an element, but is instead usually a separate node. Therefore, trying to use WebUI.getAttribute(…, ‘text’) will (almost) never work. Let me try to demonstrate the difference between a text attribute and a text node:
1.) A text attribute would look something like this:
In this scenario, you could use WebUI.getAttribute(…, ‘text’) to retrieve the value “some_text”, because text is an attribute within the <div> element. However, I don’t think I’ve ever seen a text attribute like this. As Russ mentioned, maybe you would find it in an <option> element on occasion.
2.) A text node would look something like this:
This is typically how text is presented. Since you haven’t shared any HTML, I’m assuming this is what you’re really after. If so, then again as Russ has shared, you should locate the containing element (the <div> in my example), then use WebUI.getText() on that element.