how to identify same object in different dom path

Ranorex Spy, Recorder, and Studio.
Shraddha
Posts: 1
Joined: Mon Apr 02, 2018 8:39 am

how to identify same object in different dom path

Post by Shraddha » Mon Apr 02, 2018 9:03 am

I want to handle one table header object in generic way. Defining one oject i want to handle all tables similar object.

Issue :

xpath for header 1 :
/form[@title~'.*']/container[@caption='']/container[@controlname~'.*']/container[@caption='']//element[@class='AxHeaderCtrl']/list[@accessiblename='Header Control']/cell[@accessiblename='Name']

xpath for header 2 :
/form[@title~'.*']/container[@caption='']/container[@controlname~'.*']/container[@caption='']//element[@class='AxPaneWnd']/element[@instance='0']//element[@class='AxHeaderCtrl']/list[@accessiblename='Header Control']/cell[@accessiblename='Relation']


I tried with :
Cell tbTopCell=".//element[@class='AxHeaderCtrl']/list[@accessiblename='Header Control']/cell[@accessiblename='"+StrColumnName+"']";

StrColumnName: variable where i am passing column name.
This is not woring


Is there any way to identify this object which is present in different form and different dom structure?

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

Re: how to identify same object in different dom path

Post by odklizec » Tue Apr 03, 2018 7:56 am

Hi,

Please upload a Ranorex snapshot of both forms. Without snapshot, it's hard to provide a reasonable help. Also, I'm not quite sure if you want to find elements in both forms simultaneously, i.e. if both (multiple) forms could be opened at the same time?

Generally speaking, your approach cannot work, because both forms returns different xpaths. What could eventually work, is something like this:

Code: Select all

Cell tbTopCell=".//element[@class='AxHeaderCtrl' or @class='AxPaneWnd']//list[@accessiblename='Header Control']/cell[@accessiblename='"+StrColumnName+"']"; 
But as mentioned, without snapshot (NOT screenshot), it's hard to provide a precise answer.
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