3

Let's say I have following HTML in my source code:

...
<span id=myElement>some text</span>
...

Let's also say that I have located this element via:

...
${web_element}  Get Webelement  id:myElement
...

Now I want to get the html tag of this located element, with something like:

...
${tag}  Some Keyword To Get the HTML of a located Element  ${web_element}
Log To Console  ${tag}  >> "span"
...

How would I get the HTML Tag of this element now in Robotframework? I could implement some Python code, but I can't believe, that there is no other, already bultin, feature, to get the tag of the element now.

Thanks!

Faram
  • 525
  • 6
  • 21

1 Answers1

4

Web elements have a tag_name attribute which you can access with robot's extended variable syntax.

Example:

${web_element}  Get Webelement  id:myElement
log  The tag is ${web_element.tag_name}
Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685