Problem with scroll at table body web element

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
WajdaW
Posts: 75
Joined: Wed Jan 05, 2011 6:45 pm

Problem with scroll at table body web element

Post by WajdaW » Tue Mar 01, 2011 7:49 am

I have some container in my application where html is generated and presented. Ranorex recognizes this as /dom element which is ok. In that container I have table body with table which cannot whole be placed so there issome scroll to scroll those table elements. Ranorex can detect table and normally scroll elements in this table, but the element which is in that table body and should be visible is not visible because this automatic scroll have appeared and element is beneath it. Technically, if there are no scroll element would be visible because is at the edge of this table body. Since ranorex thinks element is visible it clicks regular on place where is element. But since scroll is over that element click heappens to scroll, not to element. What can I do? If I scroll down a little bit some other element would be hidden by this scroll but in the t body area, so ranorex would think it is visible...

regards,

Vajda

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Problem with scroll at table body web element

Post by Support Team » Tue Mar 01, 2011 9:07 pm

Hello Vajda,

repository elements and the according wrapper classes have a UseEnsureVisible attribute.
Check out this link:
http://www.ranorex.com/forum/what-s-def ... -t903.html

In your case you said you don't want it to automatically scroll. Therefore set it to false,
either using the properties view or in code:

Code: Select all

Ranorex.TdTag td = "some/path/here";
td.UseEnsureVisible = false;
Regards,
Roland
Ranorex Support Team

WajdaW
Posts: 75
Joined: Wed Jan 05, 2011 6:45 pm

Re: Problem with scroll at table body web element

Post by WajdaW » Wed Mar 02, 2011 6:28 pm

It seems I haven't been clear enough. I'm ok with that when ranorex scolls for element and click on it. But this one is beneath scroll so ranorex clicks on scroll and think it clicked on element.

My item is next in list after this double item, and click is performed exactly where is pin point of arrow.
When click is performed here scroll is just moved to right.

For all elements bellow this one ranorex normally scrolls and click on them, just for this one which is on border makes mistakes.

regards,

Vajda

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Problem with scroll at table body web element

Post by Support Team » Wed Mar 02, 2011 6:45 pm

Ahhh, now I understand the problem. Could you provide us a sample application that we can reproduce the problem with? And a Ranorex snapshot of your application?

Regards,
Alex
Ranorex Team

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Problem with scroll at table body web element

Post by Ciege » Wed Mar 02, 2011 6:54 pm

I've a similar issue in the grids in our AUT.
I've written my own code to check for location of the cell to click versus the window rectangle and then check if the scroll bar is present and visible... If all things fit the parameters I have my code click the line down button once to make sure that the cell to click is not covered by the scrollbar.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

WajdaW
Posts: 75
Joined: Wed Jan 05, 2011 6:45 pm

Re: Problem with scroll at table body web element

Post by WajdaW » Wed Mar 02, 2011 7:37 pm

I cannot provide application sample since I'm not allowed, only ranorex snapshot of application. But I think it wouldn't be that hard for to make sample application with this situation.

@Ciege: I cannot locate this scrollbar with ranorex, only it's container which is some TBody element I think.

Do you have any sugesstions how to solve this?

Currently I just scroll down to the bottom of this table before start searching for elements and than no elements are behind scroll. But I would like to have some more elegant solution for this.

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Problem with scroll at table body web element

Post by Ciege » Wed Mar 02, 2011 7:41 pm

WajdaW wrote:@Ciege: I cannot locate this scrollbar with ranorex, only it's container which is some TBody element I think.
Well if you can't find the scrollbar (not sure why not) you can also get the visible properties of the *NEXT* item in your view, which will be false if your current item is under the scrollbar. So if your next item is false, scroll down one.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

WajdaW
Posts: 75
Joined: Wed Jan 05, 2011 6:45 pm

Re: Problem with scroll at table body web element

Post by WajdaW » Wed Mar 02, 2011 10:07 pm

Well, I think that could be time consuming. I have the solution for now, if something goes bad with it, I'll consider your suggestion. :)

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Problem with scroll at table body web element

Post by Ciege » Wed Mar 02, 2011 10:14 pm

WajdaW wrote:Well, I think that could be time consuming. I have the solution for now, if something goes bad with it, I'll consider your suggestion. :)
Really? It's maybe 3 - 5 lines of code... And an extra couple of seconds in run time...

Your "solution" of
just scroll down to the bottom of this table before start searching for elements
introduces its own issues... What if your table is more than 2 pages long and the cell you want is on page 2? When you just scroll to the end of the table you will now be on page 3 and still unable to click the cell. What if you happen to run your code on a different machine with different resolution? Or if you happen to run with your AUT window not fully maximized? Etc...

In my experience, just "doing something" that works this time because it's the easy way out, is not necessarily doing the right thing. In test automation it really is up to the test developer to make your tests as bullet proof and future proof as possible. The more time and money you save in future maintainability of your code the quicker and better your ROI is. Just my 2 cents... I'm off my soapbox now...
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Problem with scroll at table body web element

Post by Support Team » Thu Mar 03, 2011 12:45 am

If you know the item just below the one you want to click at, you could first click on that item, which is outside the window area and therefore the visible area would be scrolled. Now you should also be able to see the one you want to click at.

Regards,
Roland
Ranorex Support Team

WajdaW
Posts: 75
Joined: Wed Jan 05, 2011 6:45 pm

Re: Problem with scroll at table body web element

Post by WajdaW » Thu Mar 03, 2011 10:32 am

Strange, it seems that ranorex today finds this element regular (scrolls and clicks on it), but fails to find some other elements which are even visible. Actually not fail like throws some exception, but instead clicks on some random place in document, which is even worse.
If element don't exist it should return timeout exception, not to click on random place in document.

Do you have any idea?

I can provide snapshots and ranorex path for those elements.

regards,

Vajda

WajdaW
Posts: 75
Joined: Wed Jan 05, 2011 6:45 pm

Re: Problem with scroll at table body web element

Post by WajdaW » Thu Mar 03, 2011 11:21 am

It comes to my mind.
Maybe this is a problem:

Here is how I use repository to find a element, maybe I don't use TableBody properly, or something like that...

Code: Select all

 

public RF_ReportAppFolder(RepoGenBaseFolder parentFolder) :
                base("RF_Report", "/dom", null, 60000, true)
            {
                _tabview = new rf_excel_sampletax_insert_factsRepositoryFolders.TabViewFolder(this);
                _selfInfo = new RepoItemInfo(this, "Self", "", 60000, null);
            }

...

public TabViewFolder(RepoGenBaseFolder parentFolder) :
                base("TabView", "body/div/div/div/div/table/tbody/tr/td[@innertext='Presentation View']/../../../../../..", parentFolder, 60000, true)
            {
                _report_frame = new rf_excel_sampletax_insert_factsRepositoryFolders.Report_FrameFolder(this);
                _selfInfo = new RepoItemInfo(this, "Self", "", 60000, false);
            }

...

public Report_FrameFolder(RepoGenBaseFolder parentFolder) :
                base("Report_Frame", "div[2]/div[1]/div[2]/div[1]/div[1]/iframe[1]", parentFolder, 60000, true)
            {
                _tablebody = new rf_excel_sampletax_insert_factsRepositoryFolders.TableBodyFolder(this);
                _selfInfo = new RepoItemInfo(this, "Self", "", 60000, null);
            }

...

public virtual rf_excel_sampletax_insert_factsRepositoryFolders.TableBodyFolder TableBody
            {
                get { return _tablebody; }
            }

...

//  I created my custom property like this

public TBodyTag TableBody
        {
            get
            {
                return Excel2007Repository.Instance.RF_Report.TabView.Report_Frame.TableBody.Self;
            }
        }

...

//  and using this property to find items beneath it like this

ATag atag = TableBody.FindSingle("tr[5]/td[2]/a[1]", 300000);
            atag.Click();


Should I do this in some other way?

Regards,

Vajda

WajdaW
Posts: 75
Joined: Wed Jan 05, 2011 6:45 pm

Re: Problem with scroll at table body web element

Post by WajdaW » Thu Mar 03, 2011 1:51 pm

Also I'm using FIndSIngle this way:

Code: Select all

LoginUserField.FindSingle("", CustomTimeOut.SearchTime);
for some items when I want make some custom timeout in searching...

where LoginUserFIeld is Ranorex.Adapter

Code: Select all

public virtual Ranorex.Container LoginUserField
            {
                get
                {
                    return _loginuserfieldInfo.CreateAdapter<Ranorex.Container>(true);
                }
            }
Is this regular?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Problem with scroll at table body web element

Post by Support Team » Fri Mar 04, 2011 3:02 pm

Hi,

We tried to reproduce your issues but it was all working as expected. Please can you send us a sample application which will allow us to reproduce your issues. Or could you send us a Ranorex Snapshot to [email protected] ?

Thanks in advance.

Regards,
Peter
Ranorex Team

WajdaW
Posts: 75
Joined: Wed Jan 05, 2011 6:45 pm

Re: Problem with scroll at table body web element

Post by WajdaW » Sat Mar 05, 2011 12:26 pm

Ok, I sent snapshot and as much information as I could provide to [email protected]

Regards,

Vajda