the selenium module has module for keyboard keys that are impossible to type into string valuewhich function much like escape characters these values are stored in attributes in the selenium webdriver common keys module since that is such long module nameit' much easier to run from selenium webdriver common keys import keys at the top of your programif you dothen you can simply write keys anywhere you' normally have to write selenium webdriver common keys table - lists the commonly used keys variables table - commonly used variables in the selenium webdriver common keys module attributes meanings keys downkeys upkeys leftkeys right the keyboard arrow keys keys enterkeys return the enter and return keys keys homekeys endkeys page_downkeys page_up the homeendpagedownand pageup keys keys escapekeys back_spacekeys delete the escbackspaceand delete keys keys keys keys the to keys at the top of the keyboard keys tab the tab key for exampleif the cursor is not currently in text fieldpressing the home and end keys will scroll the browser to the top and bottom of the pagerespectively enter the following into the interactive shelland notice how the send_keys(calls scroll the pagefrom selenium import webdriver from selenium webdriver common keys import keys browser webdriver firefox(browser get(htmlelem browser find_element_by_tag_name('html'htmlelem send_keys(keys endscrolls to bottom htmlelem send_keys(keys homescrolls to top the tag is the base tag in html filesthe full content of the html file is enclosed within the and tags calling browser find_element_by_tag_name('html'is good place to send keys to the general web page this would be useful iffor examplenew content is loaded once you've scrolled to the bottom of the page