I have a page whose source code is not available, but there is a input box where cursor is blinking.
Can i write something into the text box without finding the element. I mean, some way where send key can automatically look for focussed inputbox and type input to it.
My code does not work obviuosly
driver.send_keys("testdata")
We can send keys without specifying elements in Python with Selenium webdriver. The tagname input is used for all the edit boxes. We shall use the find_element_by_tag_name method and pass input as a parameter to that method. Thus we need not mention element attributes explicitly.
New Selenium IDE We can input text in the text box without the method sendKeys with thehelp of the JavaScript Executor. Selenium executes JavaScript commands with the help of the executeScript method.
solved it
from selenium.webdriver.common.action_chains import ActionChains actions = ActionChains(self.driver) actions.send_keys('dummydata') actions.perform()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With