how to press enter in selenium python?

橙三吉。 提交于 2019-12-04 21:28:13

Instead of. submit() try '.send_keys(u'\ue007')'

See: http://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.common.keys

It need more clicks:

search_button=driver.find_element_by_xpath("""/html/body/span/section/nav/div[2]/div/div/div[2]/input""")

    search_button.send_keys("fast")
    while True:
        search_button.send_keys(u'\ue007')

That is very interesting. Another solution is better. It is very important to know that, you must press 2 Enter press on Instagram search box. So, for eliminating while loop, you can use this code: search_button.send_keys("#fast")

time.sleep(5)
search_button.send_keys(u'\ue007')
search_button.send_keys(u'\ue007')
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!