Page 1 of 1

How to Scroll Browser Horizontally?

Posted: Fri Jun 12, 2009 9:17 am
by thangavel
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.

Posted: Fri Jun 12, 2009 2:51 pm
by Support Team
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

Scroll a Browser

Posted: Mon Jun 15, 2009 6:10 am
by thangavel
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)));