Error when using parent::button for html-buttons

Bug reports.
rka
Posts: 18
Joined: Fri Jul 03, 2015 7:54 am

Error when using parent::button for html-buttons

Post by rka » Fri May 24, 2019 9:57 am

Hey Ranorexers,

given is the following html code:
<div>
  <button type='submit'>
    <p>variable text</p>
  </button>
</div>
I need to reach the button by first getting the text from the p tag and then go back to the button, so I'm using this xpath:

Code: Select all

//div//p[@innertext=$myVariableText]/parent::button
Btw. I know I could also use

Code: Select all

//div//p[@innertext='variable text']/..
or

Code: Select all

//div//p[@innertext='variable text']/parent::*...
So when using the first xpath, I get the error message that ranorex could not transform the element as Button.
This is right, it's an element of the type ButtonTag and not Button. But the spy also shows a button and not a buttontag in the browser.
A similar thread was already created in 2016: https://www.ranorex.com/forum/6-0-2-htm ... t9913.html

Maybe with this example you can check if this is a bug?

Ranorex Version is 9.0.1.

Best regards,
Rafael

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5066
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Error when using parent::button for html-buttons

Post by odklizec » Fri May 24, 2019 12:13 pm

Hi,

I don't know the reason why Ranorex identifies ButtonTag as Button and yet, it refuses to use it as Button? ;) However, the ButtonTag trick mentioned elsewhere should deal with this problem nicely? At least I'm using it in my web-based projects. But I agree, it's quite annoying issue and it's something Ranorex folks should look into.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

User avatar
Support Team
Site Admin
Site Admin
Posts: 11963
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Error when using parent::button for html-buttons

Post by Support Team » Mon May 27, 2019 8:48 am

Hello,

Thank you for your post.

We are currently evaluating possible solutions for the "button" vs "buttontag" issue. In the meantime, please choose "buttontag" for the discussed element.

Thank you for your input.

Sincerely,
Robert
.
Image