selenium webdriver sendkeys() using python and firefox

后端 未结 3 1133
悲&欢浪女
悲&欢浪女 2020-12-10 13:54

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():

相关标签:
3条回答
  • 2020-12-10 14:26

    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)

    0 讨论(0)
  • 2020-12-10 14:34

    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

    Mozilla Iceweasel 3.5.16, Copyright (c) 1998 - 2010 mozilla.org
    
    Distributor ID: Debian
    Description:    Debian GNU/Linux 6.0.8 (squeeze)
    Release:        6.0.8
    Codename:       squeeze
    
    0 讨论(0)
  • 2020-12-10 14:35

    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')
    
    0 讨论(0)
提交回复
热议问题