使用Selenium WebDriver和python按下ENTER键 [英] ENTER key press using Selenium WebDriver with python

查看:1297
本文介绍了使用Selenium WebDriver和python按下ENTER键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用硒python绑定模拟ENTER键?我已经尝试了以下代码块,但是它不起作用.

How can I simulate the ENTER key press using selenium python bindings? I have tried the following block but it is not working.

driver.find_element_by_xpath("html/xxxxx").send_keys('keys.ENTER')

driver.find_element_by_name("element_name").send_keys("ENTER")

推荐答案

使用API​​文档中的以下代码:

Use these codes from the API docs: http://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.common.keys

例如. ENTER将是.send_keys(u'\ue007')

Eg. ENTER would be .send_keys(u'\ue007')

这篇关于使用Selenium WebDriver和python按下ENTER键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆