How to Scroll Browser Horizontally?

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
thangavel
Posts: 50
Joined: Tue Jun 09, 2009 6:48 am
Contact:

How to Scroll Browser Horizontally?

Post by thangavel » Fri Jun 12, 2009 9:17 am

I'm testing Silver Light Application. Browser is having vertical & Horizontal scroll bars.

To click on any Silver Light Objects, It should be visible. Otherwise Script will fail because of unable to identify the objects within specific time.

So that i need to Scroll the browser to make the specific object visible.

I need suggestion to Scroll the browser Horizontally and Vertically.
Regards,
Thangavel.S

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

Post by Support Team » Fri Jun 12, 2009 2:51 pm

Hello thangavel,

This behavior is not typical and should not happen with standard Silverlight controls, i.e. usually you should be able to access controls even if they are currently not visible. Are you using a 3rd party Silverlight control?

A workaround to make your Silverlight elements visible is to click into the document and scroll with keyboard events.

Regards,
Christian
Ranorex Support Team
Last edited by Support Team on Mon Jun 15, 2009 10:23 am, edited 3 times in total.

thangavel
Posts: 50
Joined: Tue Jun 09, 2009 6:48 am
Contact:

Scroll a Browser

Post by thangavel » Mon Jun 15, 2009 6:10 am

I tried to scroll the browser using following steps. It is working. :)

int vertical = 100, horizontal = 100;

mshtml.IHTMLDocument2 ihtmlDoc2;

ihtmlDoc2 = ie.Document as mshtml.IHTMLDocument2;

scrollWidth = Convert.ToInt16(ihtmlDoc2.body.getAttribute("scrollWidth", 1));

clientWidth = Convert.ToInt16(ihtmlDoc2.body.getAttribute("clientWidth", 1));

ihtmlDoc2.parentWindow.scrollTo((clientWidth - (clientWidth - horizontal)), (scrollWidth - (scrollWidth - vertical)));
Regards,
Thangavel.S