How to select a field and type in it with Selenium?

Asked

Viewed 3,769 times

0

I’m trying to select the input field but I’m not getting it.

Error

Traceback (most recent call last):
  File "C:\Users\Pichau\Desktop\Teste.py", line 7, in <module>
    elem.clear()
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 95, in clear
    self._execute(Command.CLEAR_ELEMENT)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 628, in _execute
    return self._parent.execute(command, params)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute
    self.error_handler.check_response(response)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
WebDriverException: Message: unknown error: call function result missing 'value'
  (Session info: chrome=66.0.3359.139)
  (Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 10.0.16299 x86_64)

HTML

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
<form>
    <input type="text" name="arroz" id="feijao">
</form>
</body>
</html>

Python

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome(executable_path=r"C:\chromedriver.exe")
driver.get("http://sisbibliotec.com.br/a.html")
elem = driver.find_element_by_name('arroz')
elem.clear()
elem.send_keys('username')
  • Which version of python are you using? I ran your code here and it worked perfectly. Python 3.6

  • Both python 2.7 and 3.6 are giving this error. I’m using Windows 10 here, I don’t know if it makes a difference.

  • Could be the version of Driver too, happened this with a friend of mine from nowhere the driver started to give dick, try to catch the most current and test again, I’m using the latest driver.

  • But if the driver was not going to open the browser, and the browser is opening and redirecting to the right site, the problem is that it cannot select the field.

  • The problem that happened to my friend was also time to manipulate the information, the driver will continue opening normal I refer to some change that made it stop working right.

  • Downloaded again was first. Reply for me to put as right.

Show 1 more comment

1 answer

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.