Ask a Question

Can not click on 'caret' - invisible to TestComplete!

SOLVED
royd
Regular Contributor

Can not click on 'caret' - invisible to TestComplete!

In main menu, we have some nested sub-menu, that can be revealed by clicking on caret to expand sub-menu.  The caret is invisible to Object Spy! Tried to record script and keyword test. Both failed!

 

This is probably a good time to mention I am new to JScript/JavaScript! Example will be much appreciated. I am using  TestComplete 12 with Jascript (not converted the scripts to JavaScript yet, due to tight deadline) and IE11. Please see the screens below.

 

 

TC-caret.pngexpanded.pngcaret class-name.pngO_browser.png

Thanks in advance.

 

Dave

 

20 REPLIES 20
tristaanogre
Esteemed Contributor

OK... I think we're going to need more information about the properties of the Link object for Emergency.  Again, TestComplete is seeing this as a "Link" whose link text is Emergency with a class wrapper of "caret".  So, it's pretty much that clicking on "Emergency" will simply click on the link and not open the submenu.

I THINK what you're going to end up doing is seeing if you can call, from Panel("navMenuInner"), a "getElementByTagName and see if you can grab "caret_emergency" from somewhere in there.  

 

At this point, I don't think we will be able to use native methods or properties of the caret object to manipulate it.  We'll need to find the html tag and then act on it to see if we can get something going.


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
royd
Regular Contributor

I will try and see what I can get and report here. As Always, thanks a lot for your help Robert.

 

I will have to push through all pending scripts. In couple of days I will post what I found based on your suggestion.

 

Dave

Hi Dave,

 

Maybe not an elegant, but possible approach / workaround:

-- Talk to developers / designers (or use Object Browser to figure this out yourself) and ask them if it is a common design decision for your application that the collapsed menu has class 'caret' applied. And what class is applied if the menu is expanded;

-- Once you have figured out the above, you can write a code that will check if the given link (or its direct child) has class 'caret', which means that the menu is collapsed. Then you may execute click on the link, but not on its center (which occurs if you do not provide parameters for the .Click() method), but, for example, five pixels from left, so that the click occurred on the 'caret' glyph. E.g., something like this: link.Click(5, link.Height / 2)

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
sanjay0288
Frequent Contributor

Hi,

  I tried working on a sample page and by  using the getElementsByClass I was able to click on the caret control. Below is the sample code using which I was able to click on the main caret control link and expand the child items.

 

Sys.Browser("iexplore").Page("").Panel("container").Panel("iframecontainer").Panel("iframe").Panel("iframewrapper").Frame("iframeResult").Panel(0).Link(1).getElementsByClassName("caret")

y.item(0).click

 

You need to explore any of the below mentioned methods and check whether it might solve the problem

  1. getElementsByTagName
  2. getElementsByClassName
  3. QuerySelector

 

shankar_r
Community Hero

Hi,

 

What will happen when you double click the Emergency link.


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available


@sanjay0288 wrote:

Hi,

  I tried working on a sample page and by  using the getElementsByClass I was able to click on the caret control. Below is the sample code using which I was able to click on the main caret control link and expand the child items.

 

Sys.Browser("iexplore").Page("").Panel("container").Panel("iframecontainer").Panel("iframe").Panel("iframewrapper").Frame("iframeResult").Panel(0).Link(1).getElementsByClassName("caret")

y.item(0).click

 

You need to explore any of the below mentioned methods and check whether it might solve the problem

  1. getElementsByTagName
  2. getElementsByClassName
  3. QuerySelector

 


Yep... this is kinda what I was aiming for in my post.  Good stuff @sanjay0288.  Since there is no specific method call to click the caret and the caret doesn't show as an object, you need to work with the page source itself and grab the caret from there.  


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
royd
Regular Contributor

Hi Shaker

 

Double clicking has no effect. 😞

 

 

After trying everything that has been suggested, realized it was waist of valuable time (tight deadline). I did end up talking to developers, demonstrating the issue. They have agreed to make the necessary changes for it to be visible to TestComplete.

 

I want to thank every one trying to help me! Kudos to you all! This is a wonderful community and some great people hang out here!! Thank you! 🙂

Hi Dave,

 

Responsive and ready to help Development is usually the best way to get a fast and reliable solution to the problem. This is good that you can go this way. (Sometimes it is blocked for different reasons.)

🙂

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
royd
Regular Contributor

Hi Alex

 

You are right, I have to say that I was lucky, the developers agreed to go the extra mile in this case. Thanks for your help! 🙂

royd
Regular Contributor

Hi Alex,

 

I have to thank you for showing me how to click on an object, offsetting by pixel count! I had to use your technique get by in another area of the application!

 

Thank you! 🙂

 

@sanjay,

I am going to look into the method you suggested, once I have bit of downtime (as if that ever happens! 🙂 ). It is always good master all the tricks one can. You never know, when it will come in handy!

 

Thanks to all for your effort in helping me!

 

Regards.

 

Dave

cancel
Showing results for 
Search instead for 
Did you mean: