Reputation: 101
Trying to input username during login using send_keys()
method. I guess it's able to locate the input element, as when I run until before send_keys
it works. With sending a string value in send_keys
, it's throwing an error.
selenium.common.exceptions.WebDriverException: Message: Expected [object Undefined] undefined to be a string
What am I missing?
Python : 3.5
Selenium 3.3.1
Firefox Developer Edition or Nightly (currently version > 52)
My code snippet:
login_url = "https://korunet.co.nz/"
driver = webdriver.Firefox()
driver.get(login_url)
WebDriverWait(driver, 30).until(ec.visibility_of_element_located((By.CSS_SELECTOR, '#IDToken1')))
elem = driver.find_element_by_css_selector('#IDToken1')
elem.click()
elem.clear()
elem.send_keys("10101")
Traceback (most recent call last):
File "D:/PycharmProjects/JCBbidEntry/tests/loop2.py", line 29, in elem.send_keys("10101")
File "C:\Users\BaruaR\AppData\Roaming\Python\Python35\site-packages\selenium\webdriver\remote\webelement.py", line 347, in send_keys self._execute(Command.SEND_KEYS_TO_ELEMENT, {'value': keys_to_typing(value)})
File "C:\Users\BaruaR\AppData\Roaming\Python\Python35\site-packages\selenium\webdriver\remote\webelement.py", line 491, in _execute return self._parent.execute(command, params)
File "C:\Users\BaruaR\AppData\Roaming\Python\Python35\site-packages\selenium\webdriver\remote\webdriver.py", line 238, in execute self.error_handler.check_response(response)
File "C:\Users\BaruaR\AppData\Roaming\Python\Python35\site-packages\selenium\webdriver\remote\errorhandler.py", line 193, in check_response
raise exception_class(message, screen, stacktrace)
Upvotes: 9
Views: 5312
Reputation: 50
A solution that worked for me is to set value attribute, instead of using send_keys.
driver.execute_script("document.getElementById('login-username').setAttribute('value', 'username')")
Upvotes: 0
Reputation: 621
Updating to geckodriver 0.17.0 fixed the issue for me
Firefox 53.0.3
Selenium 3.4.3
Python 3.6
binary = FirefoxBinary('C:\\Program Files (x86)\\Mozilla Firefox\\Firefox.exe')
driver = webdriver.Firefox(firefox_binary=binary)
driver.get(url)
emailInput = driver.find_element_by_id("login-username")
emailInput.send_keys("username")
Upvotes: 0
Reputation: 11
Had a Firefox update and the same happened to me. Re-installed Geckodriver 64-bit (https://github.com/mozilla/geckodriver/releases) and it worked for me.
Upvotes: 0
Reputation: 41
Appears to be resolved, at least for me with the latest version of geckodriver 0.16: https://github.com/mozilla/geckodriver/releases/tag/v0.16.0
Note that version 0.16 requires selenium 3.4.
-Erinn
Upvotes: 4
Reputation: 21
i have also same problem in my case my geckodriver is 64bit but firefox is 32 bit it throws an error
Upvotes: 2
Reputation: 1131
Same here ... Seems to be a problem with FIREFOX ... it works as expected with CHROME ;-(
Upvotes: 3