Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting Selenium WebDriver to Scroll Down in Google Maps Directions Panel
    primarykey
    data
    text
    <p>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.</p> <p>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.</p> <p>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.</p> <p>Any help would be greatly appreciated. I have been racking my brain over the internet for the last three days searching for a solution. </p> <p>Thanks.</p> <p>Steve</p> <p>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.</p> <p>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. </p> <pre><code>driver.switchTo().frame(driver.findElement(By.id("spsizer"))); JavascriptExecutor js = (JavascriptExecutor)driver; js.executeScript("javascript:window.scrollBy(250,750)", element); driver.switchTo().defaultContent(); </code></pre> <p>Unfortunately the "panel" is not contained in a frame or is a frame ... as identified by the exception returned by Selenium:</p> <pre><code> Exception in thread "main" org.openqa.selenium.NoSuchFrameException: Element is not a frame element: DIV </code></pre> <p>I believe I have determined that panel has an ID ("spsizer") using FireBug.</p> <p>This also does not work:</p> <pre><code>element = driver.findElement(By.id("spsizer")); JavascriptExecutor js = (JavascriptExecutor)driver; js.executeScript("javascript:window.scrollBy(250,750)", element); </code></pre> <p>This just executes without scrolling to the bottom of the Directions panel but it also doesn't throw an exception.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload