Skip to content Skip to sidebar Skip to footer

Selenium Webdriver Sendkeys() Using Python And Firefox

I am using selenium 2.25.0, firefox 3 and python 2.6.6. I am trying to run a selenium function which uses sendkeys(): Webdriver.find_element_by_name( 'j_username' ).clear() webdr

Solution 1:

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 importwebdriverdriver= webdriver.Firefox()
elem = driver.find_element_by_name('j_username')
elem.clear()
elem.send_keys('username')

Solution 2:

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)

Solution 3:

My problem was identical, and I solved it by going from selenium==2.42.1 down to selenium==2.25.0

After changing my selenium version the test was able to send_keys() and submit the form using send_keys(Key.ENTER)

I am currently running windowless on a remote Debian Squeeze 6.0.8 server with Iceweasel 3.5.16

MozillaIceweasel3.5.16,Copyright(c)1998-2010 mozilla.orgDistributor ID:DebianDescription:DebianGNU/Linux6.0.8(squeeze)Release:6.0.8Codename:squeeze

Post a Comment for "Selenium Webdriver Sendkeys() Using Python And Firefox"