selenium - 使用 'Press Key' 关键字按回车键

标签 selenium robotframework

我正在使用 Robot Framework 并尝试在文本字段中模拟回车/回车键的按键。此元素背后的功能是,一旦在文本字段中输入了页码并且按下回车键,查看器将导航到该给定页面。

我试过 ascii 代码无济于事:

Press Key  css=div[id='viewer-toolbar-pagination']  \\13
Press Key  css=div[id='viewer-toolbar-pagination']  \\10
Press Key  css=div[id='viewer-toolbar-pagination']  \\176

我已将其他 ascii 代码发送到同一元素,例如\32(空格),效果很好。

任何帮助表示赞赏。

最佳答案

在 RobotFramework selenium 中按 Enter 代码是

Press Keys    locator_here    ENTER

而空间是
Press Keys    locator_here    SPACE

至少 Tab 是这样工作的,我没有测试过其他人,但我认为这会有所帮助(即使我迟到了 3 年)

关于selenium - 使用 'Press Key' 关键字按回车键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37792756/

相关文章:

java - 无效选择器异常 : invalid selector: Compound class names not permitted

java - 无法单击 selenium webdriver 中的按钮

automated-tests - 在 Robot Framework 中,如何通过为文本文件中的每一行数据创建单独的测试用例来执行数据驱动的测试?

python - 通过Robot Framework/Selenium将asar文件加载到Electron中

python-2.7 - 机器人框架将测试标记为预期失败或 XFAIL

selenium-webdriver - 检查图像文件是否存在,Robot-Framework,Selenium2Library

java - {"error":"unsupported_grant_type","error_description":"grant type not supported"} 销售队伍 Java

python selenium - 元素当前不可交互,可能无法操作

python - 没有这样的文件或目录 : 'geckodriver' for a simple Selenium application in Python

python - 如何隐藏机器人框架代码库并仅将二进制文件共享给客户端?