Webdriver provides a way to manipulate the browser's forward and backward, but does not provide a way to do so for browser Gongdong. JavaScript is then needed to control the browser's scroll bar. Webdriver provides the Execute_sript () method to execute JavaScript code.
The scenario in which a scroll bar is generally required is to read the legal document provisions at the time of registration. Determine whether the user is finished reading the standard is: scroll bar down the bottom of the page. In order to make the operation closer to the user's behavior will also use the scroll bar, such as user action elements in the second screen of the page, the general user does not see the elements to operate, then you need to now drag the scroll bar to the second screen of the page is in action.
The Window.scrollto () method is used to set the horizontal and vertical position of the browser window scroll bar. The first parameter of the method represents the horizontal left spacing, and the second parameter represents the vertical top margin. The code is as follows:
Python+selenium call JavaScript