Send keys without specifying element in python selenium webdriver

后端 未结 3 1064
小鲜肉
小鲜肉 2021-02-02 08:14

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 elem

3条回答
  •  星月不相逢
    2021-02-02 09:01

    If you get error about 'self' in this code:

    from selenium.webdriver.common.action_chains import ActionChains
    actions = ActionChains(self.driver)
    actions.send_keys('dummydata')
    actions.perform()
    

    just use:

    actions = ActionChains(driver)
    

    I don't have comment rights that's why I put this as answer

    Edit: Added this enhancement as a comment on the original answer.

提交回复
热议问题