tags:

views:

150

answers:

1

I am seeing a problem in Selenium with IE6/8 that is giving me some bad time. The problem is that the DOM window properties are not updated after actions are done and always return the default values.

To give you couple of examples:

  1. Browser is first launched in normal size (document.body.clientHeight = 500px). After I do window maximizing, the property stays 500px!

  2. Scroll top offset (document.body.scrollop) is initially 0, I then do scrolling, when I access the property it is till 0!

Has anyone seen this problem before or might know what is causing it?

A: 

To access the Window and document object in Selenium test you need to put this.browserbot.getUserWindow(). It gives you access to the page that Selenium is working on.

int offset = Convert.ToInt32(selenium.GetEval("this.browserbot.getUserWindow().document.body.scrollTop"));
AutomatedTester
Awesome, that solved my problem. Thanks!
KGR