Selenium-IDE:如何模拟不可打印的按键(ENTER、ESC、Backspace)?

发布于 2024-12-12 02:10:36 字数 518 浏览 0 评论 0原文

在 Selenium IDE 1.3.0 中模拟 ENTER、ESC、BACKSPACE 和 DOWN 的确切 HTML 代码是什么?

typeKeys 不起作用,也没有:

<tr>
    <td>keyDown</td>
    <td>id=zc_0_4_3-real</td>
    <td>10</td>
</tr>
<tr>
    <td>keyUp</td>
    <td>id=zc_0_4_3-real</td>
    <td>10</td>
</tr>
<tr>
    <td>keyPress</td>
    <td>id=zc_0_4_3-real</td>
    <td>10</td>
</tr>

What is the exact HTML code to simulate ENTER, ESC, BACKSPACE and DOWN in Selenium IDE 1.3.0?

typeKeys didn't work nor did this:

<tr>
    <td>keyDown</td>
    <td>id=zc_0_4_3-real</td>
    <td>10</td>
</tr>
<tr>
    <td>keyUp</td>
    <td>id=zc_0_4_3-real</td>
    <td>10</td>
</tr>
<tr>
    <td>keyPress</td>
    <td>id=zc_0_4_3-real</td>
    <td>10</td>
</tr>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

鸢与 2024-12-19 02:10:36

上面的解决方案都没有帮助我,但是,这里描述的特殊键做到了这一点:

http://blog.reallysimplethoughts.com/2013/09/25/using-special-keys-in-selenium-ide-part-1/

sendKeys | id=search | ${KEY_ENTER}

特殊键 - 与普通键类似,只是有点特别。 :)

None of the solutions above helped me, however, the special keys described here this did the trick:

http://blog.reallysimplethoughts.com/2013/09/25/using-special-keys-in-selenium-ide-part-1/

sendKeys | id=search | ${KEY_ENTER}

Special keys - like normal keys, only a bit special. :)

じ违心 2024-12-19 02:10:36

例如,按 Enter 提交表单,我唯一能弄清楚的是:

Command: keyPressAndWait
Target:  id=q              [depends on your form of course]
Value:   \\13              [for enter - any ascii value can go here]

所以它看起来像这样:

<tr>
<td>keyPressAndWait</td>
<td>id=q</td>
<td>\13</td>
</tr>

希望它有帮助
Paul

更新:

keyPressAndWait 已弃用

现在您可以使用:

命令:sendKeys

目标:id=<您的 id>,

值:<您的字母是 utf8,不再是 ascii>

对于不可打印的密钥,您可以查看此页面:
http://www.testingdiaries.com/selenium-ide-keypress-events/

For example to submit a form by pressing enter, the only one I can figure out is:

Command: keyPressAndWait
Target:  id=q              [depends on your form of course]
Value:   \\13              [for enter - any ascii value can go here]

So it looks like this:

<tr>
<td>keyPressAndWait</td>
<td>id=q</td>
<td>\13</td>
</tr>

Hope it helps
Paul

Update:

keyPressAndWait is deprecated

Now you can use:

Command: sendKeys,

Target: id=<your id>,

Value: <your letter in utf8 and not ascii anymore>

For non-printable keys you can have a look at this page:
http://www.testingdiaries.com/selenium-ide-keypress-events/

偷得浮生 2024-12-19 02:10:36

您可以使用 ${KEY_ENTER} 和其他键,如 ${KEY_F8}、${KEY_ESC}.. 等

这是一篇包含更多详细信息的博客文章

you can use ${KEY_ENTER} and for other keys as the same as ${KEY_F8},${KEY_ESC}.. etc

Here is a blog post with more details.

相对绾红妆 2024-12-19 02:10:36

对于较新版本的 Firefox(22 和 23),typeKeys 命令在 Selenium IDE 中不起作用。它已被弃用。您必须使用sendKeys。

command = sendKeys 
target = css=.someclass 
value = ${KEY_ENTER}

如果您想将文本与特殊键组合起来,您可以执行以下操作:

command = sendKeys 
target = css=.someclass 
value = demo${KEY_ENTER}

For the newer versions of Firefox (22 & 23) the typeKeys command won't work in the Selenium IDE. It's deprecated. You have to use sendKeys.

command = sendKeys 
target = css=.someclass 
value = ${KEY_ENTER}

If you want to combine text with special keys you can do something like:

command = sendKeys 
target = css=.someclass 
value = demo${KEY_ENTER}
染柒℉ 2024-12-19 02:10:36

这些方法不适用于 TAB 键。

要模拟按下 TAB 键,我们需要使用命令 fireEvent,如下所示

在此处输入图像描述

These methods doesn't work with the TAB key.

To simulate the TAB key pressed we need to use the command fireEvent like this

enter image description here

淡忘如思 2024-12-19 02:10:36

使用 Ctrl+A 和 Del 清除文本字段(对于 Selenium IDE):

<tr>
<td>keyDown</td>
<td>id=your text field id</td>
<td>\17</td>

<tr>
<td>keyPress</td>
<td>id=your text field id</td>
<td>\65</td>

<tr>
<td>keyUp</td>
<td>id=your text field id</td>
<td>\17</td>

<tr>
<td>keyPress</td>
<td>id=your text field id</td>
<td>\127</td>

Clear text field using Ctrl+A and Del (for Selenium IDE):

<tr>
<td>keyDown</td>
<td>id=your text field id</td>
<td>\17</td>

<tr>
<td>keyPress</td>
<td>id=your text field id</td>
<td>\65</td>

<tr>
<td>keyUp</td>
<td>id=your text field id</td>
<td>\17</td>

<tr>
<td>keyPress</td>
<td>id=your text field id</td>
<td>\127</td>

魄砕の薆 2024-12-19 02:10:36

您可以使用代码 13 为 Enter 键,代码 9 为 Tab 键,代码 40 为向下键,8 为退格键

You can use code 13 for enter key, code 9 for tab key, code 40 for down key, 8 for backspace key

她如夕阳 2024-12-19 02:10:36

如何通过 Selenium IDE 记录 Enter 键的最佳答案

<tr>
<td>keyDown</td>
<td>id=txtFilterContentUnit</td>
<td>\13 </td>
</tr>

其工作原理我在 Selenium IDE 上尝试过。将 txtFilterContentUnit 替换为您的文本框名称。

希望你能做到-Abhijeet

The Best Answer to the qs how to Record the Enter Key Through Selenium IDE

<tr>
<td>keyDown</td>
<td>id=txtFilterContentUnit</td>
<td>\13 </td>
</tr>

Its Working i tried that on Selenium IDE here. replace txtFilterContentUnit with your text box name.

hope u can do it -Abhijeet

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文