Is there a way to find the tooltip of a text field using a script?
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there a way to find the tooltip of a text field using a script?
I have a .NET application that I am writing a script for to check the min and max range of text fields. If the value entered is out of range then a tooltip appears stating the range. Is there a way to check to see if this tooltip appears without previously knowing the name of this tooltip? I'm envisioning something like click a textbox, entering a value out of range, and then searching to see if there is a tool tip on the screen. If there is then get the text from it. Does this sound possible?
There would only ever be one tooltip at a time.
Here is a pic for reference
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many times, an object will have a property called "Tooltip". The tooltip itself is not a seperate object but a property that is populated as needed.
So... my first thing to check would be to use the TestComplete Object Spy to inspect the edit field and look to see if such a property exists. If this works, you wouldn't need to know the name of the tooltip object, simply check the tooltip of the edit box and validate the text.
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the response. Using the object spy I went to the all the properties of the control and I only saw two properties: "ToolTipsEnabled" and "m_activateToolTip". It saysthat ToolTips is enabled for this control but that doesn't really help me.
I just tried using this link to map the control wnd class to a win32 tool tip as done in the documentation but there was no difference in what information was available.
I feel like this should be a simple task, but I am making absolutely no progress towards this and its important that TC is able to recognize the tooltips.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As mentioned... that was step one... .time to play Sherlock, my friend.
so... step 2, since there doesn't appear to be a relevant property on the target object, the tooltip probably is a separate object.
Using Object Spy, there's a method for object spy called Point and Fix. Instead of the target reticule, you can use the Point and Fix method to highlight objects that might not be able to be targetted... can you use that for highlighting the tool tip?
To anticipate your question as to why I don't have a "Well, all you have to do is reverse the polarity of the neutron flow" is because there are many different ways for developers and components to generate tool tips. So, we need to investigate and find it. Now, of course, if you have access to the developers, you could ask them... show them what you're trying to do, sit with a developer with TestComplete open, show them the Object Browser... and see if they can help you find the tooltip. Honestly, that's the best way to go to make your life easier...
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok thanks for the continued support. By point and fix do you mean hovering over it with my mouse until the red rectangle is around it? If so, the answer is yes and no. Yes when the tool tip appears I can hover over it and a red rectangle will appear around the tooltip. No, in the sense that if I try to capture that tooltip red rectangle by putting a checkpoint there or just simply clicking on it, then it disapears and TC doesn't ever give it an object name.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just tried using the object spy option (as opposed to the red rectangle which is what I usually do) and I was able to capture the tooltip object. Not sure if this helps or not.
The windClass name is WindowsForms10.tooltips_class32.app.0.33c0d9d
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK so another update. I was able to get the tool tip class mapped to the win32 tool tip. Before I was using the wrong class to map it. TC now recognizes the tooltip as an object and I can hover over it and it allows me to select the gettxt property.
Unfortunately, when I do this checkpoint during test and stop recording, the checkpoint step does not show up. I think this is some kind of glitch from an incompatability with TC and the application I am using. The application is an old one that uses a mixture of winforms and WPF. It has parts built by multiple different companies and is government owned software.
I had another weird issue using TC with this software, where it no longer allowed me to tab through fields. Without TC running I could launch the app and tab through each field, but after I started recording with TC the application no longer accepted tab inputs - even after I close out TC.
I submitted a ticket to SmartBear support, but they said they can't do anything if I can't send them the application. Since the application is government owned I can't simply do that. So I think this is going to be another one of those problems.
Thanks for the help
