'How can you input text into an input element without using send keys in Python Selenium?
I'm working with a website where send_keys sometimes works and sometimes doesn't (I have no idea why). Sometimes it sends keys then I try a few hours later and it doesn't work anymore. I was wondering if anyone knew a way to send text/numbers into a input element WITHOUT using send_keys.
For example, would it be possible to input text into the following element without using send_keys:
<input _ngcontent-coh-c546="" type="text" name="tag" maxlength="25" placeholder="Tags" class="ng-dirty ng-valid ng-touched">
Any help would be greatly appreciated. Thank you.
Solution 1:[1]
This should work effectively and faster compared to send_key
from selenium import webdriver
driver = webdriver.Chrome('chromedriver')
driver.get("http://www.google.com");
driver.execute_script("document.getElementsByName('q')[0].value='What ever you want to be typed here'")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Flow |
