We actually automated testing process, is sure to encounter less than the current page display elements of our positioning. This requires Scroll down to show our element;
The scroll bar and buttons are not our positioning, it is necessary to use js script to do;
1. First is our Scroll down operations:
# Designed by js script; absolute coordinates of points by moving # coordinate origin (0, 0) get_driver.maximize_window () # maximize the window the time.sleep (3 ) get_js = " window.scrollTo (0,500); " # write js script, the scroll bar to scroll to the 500 position, if there is more than js script will only execute the last one. get_driver.execute_script (get_js) # execute js script
2. If you want to scroll down many times:
get_driver.maximize_window () # maximize the window the time.sleep (3 ) get_js = " window.scrollTo (0,200); " # write js script, the scroll bar to the 300 position get_js1 = " window.scrollBy (0,300); " # js script you need to perform multiple use scrollBy; pull down again to the 300 position get_driver.execute_script (get_js) # execute js script get_driver.execute_script (get_js1) # execute js script
3. The positioning of the elements you want to display directly visible window:
get_driver.maximize_window () # maximize the window the time.sleep (3 ) get_js = " window.scrollTo (0,200); " # write js script, the scroll bar to the 300 position get_js1 = " window.scrollBy (0,300); " # js script you need to perform multiple use scrollBy; pull down again to the 300 position get_driver.execute_script (get_js) # execute js script get_driver.execute_script (get_js1) # execute js script