views:

26

answers:

2

I'm trying to automate some tests on Internet Explorer. How can I find out if the state of the webpage being shown is changed? Is there any way to know when the page finished loading, if it changes, if it is scrolled, etc.?

I want to know how I can get this state information from another running process.

+1  A: 

Selenium allows you to test for completion of a page load and many other events within Internet Explorer and many other web browsers. It's a tool for autmoated testing of web pages.

It allows you to write tests that perform actions and test the state of pages.

You could either look at the source for selenium and see what it's doing or just use it to do your testing.

I'm not sure how a web page would scroll by iteself in an automated test, but you could detect if the scroll Has happened by storing the window.scrollX value when the page is loaded and testing to see if the value has changed.

Robert Christie
But will Selenium detect scrolling of the web page?
Robert Harvey
@Robert Harvey: Not directly as far as I know, but I've added an example of how you can do it by checking properties of the browser window.
Robert Christie
A: 

Basically, if you want to detect things like window scrolling in Internet explorer, you probably need your own piece of code running in the browser, like a BHO (Browser Helper Object).

There might be a way to do Event Sinking. Have a look here: http://asp.dotnetheaven.com/howto/doc/Interop/TestClient_2.aspx

Robert Harvey