selenium webdriver sendkeys() using python and firefox - Stack Overflow
python - Selenium - send keys - what element should I use - Stack Overflow
To send threekeys using send_keys() in selenium python webdriver - Stack Overflow
What am i doing wrong here? Selenium send_keys().
From reading the output, I assume it is a version mismatch between Google Chrome and Chrome Driver. Checking "ChromeDriver 2.34" release notes on the main site(https://sites.google.com/a/chromium.org/chromedriver/downloads) clearly says it supports Chrome v61-63, whereas yours is v65.
You have 2 options: 1(The better one). Upgrade Chrome Driver to the latest version 2. Downgrade Google Chrome to a supported version from ChromeDrvier 2.34
More on reddit.comWhat is the alternative to SendKeys in Selenium?
How to use XPath in Selenium?
What is the Knowledge Pass, and how does it work?
Videos
your code looks odd. typically, you locate an element, and then do actions with it... rather than locating it each time.
try something like this:
from selenium import webdriver
driver = webdriver.Firefox()
elem = driver.find_element_by_name('j_username')
elem.clear()
elem.send_keys('username')
Use following as a work around I think It may work.
driver = webdriver.Firefox()
elem = driver.find_element_by_name('j_username')
elem.clear()
app = Application.Application()
app.window_(title_re='*.Firefox.*').TypeKeys('username')
Last two lines are in Python(pyWinauto)
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)
A simple javascript should be sufficient as well. Python syntax
driver.execute_script("window.scrollTo(0,document.body.scrollHeight);")
I've had good results with:
from selenium.webdriver.common.keys import Keys
element.send_keys(Keys.CONTROL, 'a')
element.send_keys('123.00')
If that doesn't work it may have something to do with the code in the web page.
Unless you have custom editbox, click() should work for you:
from selenium.webdriver import Firefox
b = Firefox()
b.get('http://google.com')
e = b.find_element_by_id('lst-ib')
e.click() # is optional, but makes sure the focus is on editbox.
e.send_keys('12.34')
e.get_attribute('value')
# outputs: u'12.34'
e.click()
e.clear()
e.get_attribute('value')
# outputs: u''
e.send_keys('56.78')
e.get_attribute('value')
# outputs: u'56.78'