[Spy vs Automation]Button or not, that's the question

Ranorex Spy, Recorder, and Studio.
andrefelipe
Posts: 13
Joined: Tue Feb 03, 2015 6:00 pm

[Spy vs Automation]Button or not, that's the question

Post by andrefelipe » Mon Feb 16, 2015 7:49 pm

My Ranorex version is: 5.2.2
Windows 7 Enterprise 32 bits
I'm evaluating the product.

I'm having difficulties to interact with what I think that's a button in my system.
In the spy its selected as a button, and the Spy can highlight it without any problem.
Heres the exception.

Code: Select all

Item 'ProjetoPilotoRepository.SESuite2.Categoria.BuscarIcone' is no Button.
The element does not support the required capability 'button'. 

at Ranorex.Core.Repository.RepoItemInfo.Find[T](Boolean findSingle, Boolean throwException, Duration effectiveTimeoutOverride) at Ranorex.Core.Repository.RepoItemInfo.CreateAdapter[T](Boolean throwException, Duration waitTimeout) at Ranorex.Core.Repository.RepoItemInfo.CreateAdapter[T](Boolean throwException) at ProjetoPiloto.ProjetoPilotoRepositoryFolders.CategoriaFolder.get_BuscarIcone() in c:\Users\Administrator\Documents\Ranorex\RanorexStudio Projects\ProjetoPiloto\ProjetoPiloto\ProjetoPilotoRepository.cs:line 1425 at ProjetoPiloto.CadastrarCategoria.Ranorex.Core.Testing.ITestModule.Run() in c:\Users\Administrator\Documents\Ranorex\RanorexStudio Projects\ProjetoPiloto\ProjetoPiloto\CadastrarCategoria.cs:line 120 at Ranorex.Core.Testing.TestSuiteModule.RunInternal(DataContext parentDataContext)
But as you can see it's a "button".

Code: Select all

<button type="button" tabindex="60" title="Selecionar ícone" id="zoom_symbol" class="         defaultZoom defaultZoomBtnOver" onclick="zoom_scorelevel_symbol();"><img src="../../common/baseclass/imgs/smlbuttons/zoom.gif" width="13px" height="16px" class=" imageDefaultZoomButtonOver"></button>
Path that the click doesn't work:

Code: Select all

body//button[@id='zoom_symbol']
Path that the click works:

Code: Select all

body//button[@id='zoom_symbol']/img[@src<'zoom.gif']
I don't like to use images because they usually change, so better to select it, with the main button.

Theres a snapshot attached. I hope it helps.

Thanks in advance!
Attachments
button problem.rxsnp
(435.26 KiB) Downloaded 91 times

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

Re: [Spy vs Automation]Button or not, that's the question

Post by krstcs » Mon Feb 16, 2015 8:38 pm

Try using "/buttontag" and see if that works.

If it does, you can leave it as "buttontag".

OR, you can go into the repository and right-click the element and select Properties. Then, in the property pane, make sure the Adapter Type property is set to buttontag.


Button and buttontag elements are technically different.

Button is a form element on Java/WPF/WinForms/etc.

ButtonTag is a <button /> tag in html.

Ranorex fixed it a while back so that you can use "button" and it will work with "buttontag" elements, but sometimes it needs to be told specifically.
Shortcuts usually aren't...

andrefelipe
Posts: 13
Joined: Tue Feb 03, 2015 6:00 pm

Re: [Spy vs Automation]Button or not, that's the question

Post by andrefelipe » Tue Feb 17, 2015 11:13 am

With buttontag, spy didn't find it. And checking the adapter theres no option ButtonTag, only unknown and webelement. I got your point here, forms button =/= html button, ofc, but theres no option to change it, and buttontag doesn't work.

Thank you for your time :)

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

Re: [Spy vs Automation]Button or not, that's the question

Post by krstcs » Tue Feb 17, 2015 4:10 pm

Hmm...

It IS a buttontag element, Spy finds it just fine as a buttontag when I try with the snapshot you posted. It's HTML <button>, so I'm not sure why it isn't working for you.


Have you tried any other actions against it besides click? Maybe try the InvokeAction.PerformClick() action?
Shortcuts usually aren't...

andrefelipe
Posts: 13
Joined: Tue Feb 03, 2015 6:00 pm

Re: [Spy vs Automation]Button or not, that's the question

Post by andrefelipe » Wed Feb 18, 2015 11:33 am

Performclick works, honestly if you are using my snapshot, I have no idea why it didn't work here. Probably my mistake, I'll check it again.

Thank you very much!

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

Re: [Spy vs Automation]Button or not, that's the question

Post by krstcs » Wed Feb 18, 2015 3:23 pm

You're welcome!
Shortcuts usually aren't...

andrefelipe
Posts: 13
Joined: Tue Feb 03, 2015 6:00 pm

Re: [Spy vs Automation]Button or not, that's the question

Post by andrefelipe » Wed Feb 18, 2015 7:46 pm

Just to make it clear, that the buttontag didn't work, because of my mistake, I missed a "/" in the Xpath, sorry. It's working now.

Once again, thanks!