cancel
Showing results for 
Search instead for 
Did you mean: 

identify a web element

SOLVED
Highlighted
Occasional Contributor

identify a web element

Hi,

 

I have a web element without any static identifier.

So i decide to detect this element using the css selector , based on the text.

But i don't find a way with testComplete scripting.

The example is :  <span >CHF</span>

 

 

Thank you for your support,

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: identify a web element

Have you looked at this article?

 

https://support.smartbear.com/testcomplete/docs/app-testing/web/general/common-tasks/finding-objects...


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

5 REPLIES 5
Highlighted
Community Hero

Re: identify a web element

Have you looked at this article?

 

https://support.smartbear.com/testcomplete/docs/app-testing/web/general/common-tasks/finding-objects...


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

Highlighted
Occasional Contributor

Re: identify a web element

Hi Robert,

Thank you for your response.

 

The solution is working for me, but using this solution I should get all elements with the same selector and filter after that the result by text, it is taking much time and performance that's why i am searching for a direct solution like the function span:contains('CHF') which is not supported by testComplete.

 

BR,

Highlighted
Community Hero

Re: identify a web element

So, the next question is, why are you using CSS Selector?  Is this an object that cannot be idenfied via Object Browser or Object Spy and, therefore, unable to be mapped via NameMapping?


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Occasional Contributor

Re: identify a web element

The tested object can be identified via Object spy, but it has no unique criteria for the identification.

I will accept your solution, i think there is no other way.

 

Highlighted
Community Hero

Re: identify a web element

It may not have a single property but there may be a combination of properties that sets it apear from others.  You say you want to use the CSS Selector.  Those properties are also accessible for NameMapping.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!

Retrieve Data from a Web Page

Participate!
Top Kudoed Authors