How to deal with angularjs span tags

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
roxter
Posts: 22
Joined: Thu May 12, 2016 10:18 am

How to deal with angularjs span tags

Post by roxter » Wed Sep 14, 2016 10:13 am

Hi!
I am busy automating an angularjs web application.
There are some difficulties identifying some of the angular objects.
I would like to perform a click action on a link which resides inside a span tag.

I mapped the object with the spy but when doing playback of the test the object is not found. Ranorex path seems to be incorrect.

Ranorex is not able to find the correct path to the object. Any idea how to deal with angularjs object?
Please see 2nd screenshot.
In the Spy it looks like the object can be correctly mapped, highlighting the element work in the spy.
But when I apply the path to the object in the repository, the object can not be found, please see 1st screenshot.
Last edited by roxter on Thu Sep 15, 2016 3:12 pm, edited 1 time in total.

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

Re: How to deal with angularjs span tags

Post by odklizec » Wed Sep 14, 2016 11:29 am

Hi,

Could you please upload a Ranorex snapshot (not screenshot) and complete xpath as recorded in repository?

The path looks complex, with too many '?', very little unique IDs and some indexes which are often not persistent and likely a cause of your problem. Please post the snapshot, so we can evaluate your xpath.
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

roxter
Posts: 22
Joined: Thu May 12, 2016 10:18 am

Re: How to deal with angularjs span tags

Post by roxter » Wed Sep 14, 2016 1:05 pm

Hi!
The recorded Xpath is:

/dom[2]//div[#'content']//tag[@tagname='as-selector-view']/div/div[2]/?/?/tag[@tagname='as-structure-tab']/div/div/div[2]/div[1]/a[@href~'^http://localhost:3000/\#/domain']/span[@innertext='Leistungsumfang']

This path to the object will not work if I start the test run, object will not be found.
I attached a snapshot.
Last edited by roxter on Thu Sep 15, 2016 3:12 pm, edited 1 time in total.

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

Re: How to deal with angularjs span tags

Post by odklizec » Wed Sep 14, 2016 1:44 pm

Hi,

As I've suspected, the issue seems to be an index number in the xpath. Is there a reason why you are using /dom[2] at start of the xpath, instead of proper domain name as stored in the snapshot:
/dom[@domain='localhost:3000']
Also, I would suggest further simplify the xpath, to eliminate similar problems in future. Try something like this:
/dom[@domain='localhost:3000']//div[#'content']//tag[@tagname='as-selector-view']/div//tag[@tagname='as-structure-tab']/div//a[@href~'^http://localhost:3000/\#/domain']/span[@innertext='Leistungsumfang']
Hope this helps?
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