I am trying to get Selenium, specifically WebDriver v2.31, to interact with Google Maps. I able to get as far as clicking the [first] Get Directions button to enter a pair of addresses and then click the Get Directions button under the two addresses. This results in a set of driving directions. What I cannot do is get Selenium to scroll to the bottom of the "Directions" panel so I can see the destination and the Save to My Maps link. I don't know if the problem arises because the scroll bar is generated by the browser.
I am able to perform a search on Yahoo! and scroll to the bottom of the results webpage; I think it is because there are no other frames or panels in the webpage's architecture. Although that being said, the browser generated the scroll bar, not the webpage.
I can build an Action with the mouse holding down and dragging the scroll bar down. I don't like that solution because if the page is sized differently or the panel is sized differently, it will cause a lot of recalculation to perform this action. I would prefer a solution that is similar to the single "document" window in Yahoo! or Google Code.
Any help would be greatly appreciated. I have been racking my brain over the internet for the last three days searching for a solution.
Thanks.
Steve
Addendum: As noted below. I am not trying to do anything with the map itself but rather the panel that contains the directions. I am using Google Maps because it is similar to an application I will have to test later. I need the ability to have [Selenium] WebDriver scroll to the bottom of the panel so I can select a "Next" link -- just like scrolling to the bottom of the Directions panel in Google Maps and seeing the Save link at the bottom.
I am not sure if I am using the correct terminology when I use the term panel. The problem is that it appears the panel generates the scroll bar dynamically when the web page is displayed.
driver.switchTo().frame(driver.findElement(By.id("spsizer")));
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("javascript:window.scrollBy(250,750)", element);
driver.switchTo().defaultContent();
Unfortunately the "panel" is not contained in a frame or is a frame ... as identified by the exception returned by Selenium:
Exception in thread "main" org.openqa.selenium.NoSuchFrameException: Element is not a frame element: DIV
I believe I have determined that panel has an ID ("spsizer") using FireBug.
This also does not work:
element = driver.findElement(By.id("spsizer"));
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("javascript:window.scrollBy(250,750)", element);
This just executes without scrolling to the bottom of the Directions panel but it also doesn't throw an exception.