9

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)

4
  • Could you share URL or HTML Code Commented Apr 3, 2017 at 10:49
  • So I have been using Firefox developer edition(which was in my Windows path). When I use the stable version, and explicitly specify the binary via "binary = FirefoxBinary(r'C:\Program Files\Mozilla Firefox\firefox.exe')" , then it works fine. Commented Apr 7, 2017 at 0:10
  • 1
    This seems to be a bug with FF 53 beta. Commented Apr 11, 2017 at 22:23
  • Raised - github.com/webcompat/web-bugs/issues/5601 (I would put it as a comment, but don't have 50 reputation:) ) Commented Apr 12, 2017 at 8:15

6 Answers 6

4

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

Sign up to request clarification or add additional context in comments.

1 Comment

I also resolved it using the version 0.16 of geckodriver and upgrading selenium. Thanks!
3

Same here ... Seems to be a problem with FIREFOX ... it works as expected with CHROME ;-(

2 Comments

It's in the unstable versions of firefox only, the release version and the older versions work fine. I donno where to file this bug though.
thanks @najjarammar - after using regular firefox everything worked out fine
2

i have also same problem in my case my geckodriver is 64bit but firefox is 32 bit it throws an error

2 Comments

This is not an answer, you can put in comment or up vote for this question
it was a useful answer for me. YMMV.
0

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.

Comments

0

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")

Comments

0

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')")

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.