Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium - send keys - what element should I use

I'm trying to scroll at the bottom of the page. I was adviced, here on SO, to do this:

from selenium.webdriver.common.keys import Keys
element = driver.find_element_by_ ...
element.send_keys(Keys.CONTROL , Keys.END)

I can't figure out what element shoul I use. I was trying to put a webdriver instance instead of element but it did not work. I need something like current window element?

Have you any ideas?

like image 609
Milano Avatar asked Jun 19 '15 11:06

Milano


1 Answers

This should be enough to make scroll to page bottom

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver=webdriver.Chrome()
driver.get("site_name")
driver.find_element_by_xpath('//body').send_keys(Keys.CONTROL+Keys.END)
like image 147
Andersson Avatar answered Oct 02 '22 17:10

Andersson