Handling Nested Scroll Bars with selenium webdriver

7,676 views
Skip to first unread message

Akarsh

unread,
Aug 21, 2012, 10:01:23 AM8/21/12
to webd...@googlegroups.com
I am using selenium webdriver. In my application header is constant.
And different part of the page has its own scroll bars is there any way to control these individual scrolls with selenium webdriver. If i am using
javascript: window.scrollTo(0,0)
but the behaviour is not deterministic if i m inside the context of inner scroll bar i m not able to scroll main window.
Any Help....

Thanks

Peter Gale

unread,
Aug 21, 2012, 10:26:37 AM8/21/12
to webd...@googlegroups.com

Webdriver scrolls elements into view when you select of click on them.

So there's no need to use javscrascript, but if you choose to do so that is not a Webdriver issue.

If WebDriver isn't workin gas it should be then show us the details and someone will try to help resolve the issue.


Date: Tue, 21 Aug 2012 07:01:23 -0700
From: akars...@gmail.com
To: webd...@googlegroups.com
Subject: [webdriver] Handling Nested Scroll Bars with selenium webdriver
--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/CXnWGZKvJPYJ.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

Akarsh

unread,
Aug 22, 2012, 12:59:54 AM8/22/12
to webd...@googlegroups.com
With Web driver i dont face problem in scroll down but it miss clicks on floating header when try to click on element which require scroll up.
Not able to find any way to scroll inside dhtml grid.

Akarsh

unread,
Aug 22, 2012, 1:56:18 AM8/22/12
to webd...@googlegroups.com
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
div.scroll
{
background-color:#00FFFF;
width:100px;
height:100px;
overflow:scroll;
}

div.hidden
{
background-color:#00FF00;
width:100px;
height:100px;
overflow:hidden;
}
</style>
</head>

<body>
<p>The overflow property specifies what to do if the content of an element exceeds the size of the element's box.The overflow property specifies</p>

<p>overflow:scroll</p>
<div class="scroll">You can use the overflow property when you want to have better control of the layout. The default value is visible.</div>

<p>overflow:hidden</p>
<div class="hidden">You can use the overflow property when you want to have better control of the layout. The default value is visible.</div>
</body>
</html>

My elements are inside the div with scroll bars when i try to type in text field than click on next element require scroll up window(window scroll bar not div) which is not happening.

Peter Gale

unread,
Aug 22, 2012, 2:22:53 AM8/22/12
to webd...@googlegroups.com
Akarsh

I'm not sure how this is supposed to help clarify the problem for us.

I think you need to provide a simple reprodicable test case. i.e. a complete web page either as an attachment or a public site, and small set of code that together show the problem.

Then we might be able to see the problem in action for ourselves and pinpoint where the issue is, or confirm that it seems to be a bug in WebDriver.

Peter


Date: Tue, 21 Aug 2012 22:56:18 -0700
From: akars...@gmail.com
To: webd...@googlegroups.com
Subject: [webdriver] Re: Handling Nested Scroll Bars with selenium webdriver
--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/tEqqisGn9T4J.

David

unread,
Aug 22, 2012, 1:15:51 PM8/22/12
to webdriver
> If i am using
> javascript: window.scrollTo(0,0)
> but the behaviour is not deterministic if i m inside the context of inner
> scroll bar i m not able to scroll main window.

What happens when you're in the context of inner scroll bar area? Any
scrolling occur within inner scroll bar? Or nothing happens to either
scroll bars?

> Not able to find any way to scroll inside dhtml grid.

Maybe not a concern for others, but out of curiosity on test
automation and web development, is there javascript code that can be
written to scroll scrollbars that are part of an element (e.g. div,
textarea, span, iframe, frame, etc.)? I think most people think to
control scrolling at the browser window level only (or I mis-assumed).
Maybe something like to
document.getElementById('someId').scrollTo(x,y) or more complicated
stuff like the mouseOver event emulation with javascript?

Akarsh

unread,
Oct 20, 2012, 7:43:01 AM10/20/12
to webd...@googlegroups.com
This seems to be issue issue in webdriver. As a workaround i am scrolling using javascript :
<divId>.scrollTop = 0;
or for main window:  window.scrollTo(0,0) 

this way i am scrolling wherever webdriver fails to handle. I am not sure exactly in which case webdriver fails to scroll and for which interaction. As far as i noticed scroll issue comes frequently for click than type.
And problem comes in case of nested div or tables all with scroll bars.
Reply all
Reply to author
Forward
0 new messages