cancel
Showing results for 
Search instead for 
Did you mean: 

[TestLeft] How to interact with an object that needs scrolling to view (Desktop application)

Occasional Contributor

[TestLeft] How to interact with an object that needs scrolling to view (Desktop application)

Hi 

I m currently automating a Desktop application using C# NUnit, TestLeft, most of the objects identified are MSAAObjects.

I want to click on an object which is not visible on screen and I get the following error

SmartBear.TestLeft.TestObjects.InvocationException: 'There was an attempt to perform an action on a zero-sized window.

The window size is (0, 0); the screen rectangle: the left top corner is (0, 0), the right bottom corner is (0, 0)

 There is a bit of scrolling involved to get the object visible on screen, so I tried

//obj is of type IMSAAObject

     while (!obj.VisibleOnScreen)

            {

                driver.Desktop.Keys("[Down]");

            } 

But this takes ages to get to that object.

Is there a proper way to scroll to view the object? This is a MSAAObject, so there is no Focus() or ClickItem() options

Any sort of help is appreciated

Thanks in advance

3 REPLIES 3
Community Hero

Re: [TestLeft] How to interact with an object that needs scrolling to view (Desktop application)

Hi,

 

As a quick idea and assuming that the problematic control resides on some form with scrollbar:

Try to send .Keys("[PgDown]") not to the desktop, but to the proper scrollbar of the form.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Highlighted
Occasional Contributor

Re: [TestLeft] How to interact with an object that needs scrolling to view (Desktop application)

Thanks for the response,

 

I did use the .Keys("[PageDown]") on the scrollbar, it does scroll to display next set of objects. However I was hoping to find a better way to bring the intended object to display by using that object iteslf.

 

At any given scrolled position I should be able to find that object(that object can be at the top(Up) or bottom(Down) of the form irrespective of the current scrolled position).

 

For now I am using 

 

//1019 is the ScreenTop value(position of the indicator) of the scroll indicator when it is scrolled down to maximum

     

     var downMax = false;

            while (!object.VisibleOnScreen)

            {

                if (scrollBarIndicator.ScreenTop < 1019 && !downMax) 

                {

                    scrollBar.Keys("[PageDown]");

                }

                else

                {

                    down = true;

                    scrollBar.Keys("[PageUp]");

                }

             }

 

This works, but, is there a nicer way to get to the object which is not visible on screen?

Community Hero

Re: [TestLeft] How to interact with an object that needs scrolling to view (Desktop application)

Hi,

 

is there a nicer way to get to the object which is not visible on screen?

I'm afraid that there is not...

TestComplete (and TestLeft) can automatically put into view quite a few controls, but not MSAA ones, according to my knowledge.

For official reply you may ask Support directly via the https://support.smartbear.com/message/?prod=TestLeft form and I will appreciate it if you update this thread in case they provide better solution.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================