Set value in form field (or string input)

Asked

Viewed 303 times

0

I have a form field that contains a built-in Javascript, which works dynamically.

<input type="text" id="txtPreferencia" title="Tecla de atalho: Alt+R" name="txtPreferencia" class="infraText infraAutoCompletar" maxlength="300" tabindex="501" value="" autocomplete="off">

This field lists values, and I need to either type a certain value in it, or select one of the values from the list. I can locate the web element:

menu = browser.find_elements_by_id("txtPreferencia")

But I can’t type anything using the command SEND_KEYS, because the program gives error when I try. The error:

Traceback (most recent call last):
  File "<pyshell#67>", line 1, in <module>
    menu.send_keys("Teste")
  File "C:\Users\Bergo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 349, in send_keys
    'value': keys_to_typing(value)})
  File "C:\Users\Bergo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 493, in _execute
    return self._parent.execute(command, params)
  File "C:\Users\Bergo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 256, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Bergo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: call function result missing 'value'
  (Session info: chrome=75.0.3770.142)
  (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.1.7601 SP1 x86_64)
  • Man, I’m pretty sure it’s by find_elements_by_id exchange for find_element_by_id. That one find_elements_by_id is only used to search for elements that have the same id and it returns an array to you. If it is not this puts error that you are giving, it helps to help you!

  • Oops! Grateful! I switched, but it gives the same error when I try to run a "SEND_KEYS".

  • puts more of your code, like import, Please! Only this line of code becomes too vague.

  • Hello. I appreciate the help. I found that it was merely a "defect" in the Chrome driver. With the update, the operation has been normalized and the field is interacting with the application normally!

No answers

Browser other questions tagged

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