se7ent7
14 years agoOccasional Contributor
Using custom properties to find web objects/elements
Hi there, I have
been finding objects using the Id string (we use a FindChildByID()
method), but this is becoming hard to maintain recently since our app
generates IDs more dynamically these days.
We added a "qaid"
(quality assurance ID) property, which can be seen with F12 (Tools) in
IE or Firebug in Firefox, but not by TestComplete's Object Spy.
How do I get TestComplete to see that property?
Here is an example of how an element looks when using F12 in Internet Explorer:
<span
id="ctl00_ContentPlaceHolderMain_Folders_RepeaterFolders_ctl03_CollapsiblePanelFolder"
_behaviors="[object Object]" CollapsiblePanelBehavior="[object Object]"
qaid="Site Photograph">
So I want to be able to say:
var SitePhotographPanel = WebUtils.FindChildByQAID(this.pageObj, "Site Photograph");
A colleage suggested using EvaluateXPath, so I tried this:
var contentPanel = this.pageObj.EvaluateXPath("//*[@qaid=’Site Photograph’]");
No luck Please help
been finding objects using the Id string (we use a FindChildByID()
method), but this is becoming hard to maintain recently since our app
generates IDs more dynamically these days.
We added a "qaid"
(quality assurance ID) property, which can be seen with F12 (Tools) in
IE or Firebug in Firefox, but not by TestComplete's Object Spy.
How do I get TestComplete to see that property?
Here is an example of how an element looks when using F12 in Internet Explorer:
<span
id="ctl00_ContentPlaceHolderMain_Folders_RepeaterFolders_ctl03_CollapsiblePanelFolder"
_behaviors="[object Object]" CollapsiblePanelBehavior="[object Object]"
qaid="Site Photograph">
So I want to be able to say:
var SitePhotographPanel = WebUtils.FindChildByQAID(this.pageObj, "Site Photograph");
A colleage suggested using EvaluateXPath, so I tried this:
var contentPanel = this.pageObj.EvaluateXPath("//*[@qaid=’Site Photograph’]");
No luck Please help