使用C#在Selenium RC中按Enter键 [英] Press Enter Key in Selenium RC with C#
本文介绍了使用C#在Selenium RC中按Enter键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用C#使用Selenium RC按下Enter键?
How to press Enter using Selenium RC using C#?
我正在使用Selenium
与SearchBox
一起工作.
我必须在其中键入一些名称,然后按 Enter 进行搜索.
I am working with a SearchBox
using Selenium
.
In which I have to type some name and I have to press Enter to search.
没有Submit
按钮.因此,我必须使用 Enter .
There is no Submit
button. So, I must use Enter.
我尝试过类似的事情
selenium.KeyPress("quicksearchtextcriteria", "13");
但是不起作用.
请帮助.
注意:我收集了一些可能的方法来做到这一点.参见此处:按Enter键输入硒
Note: I made a collection of possible ways to do this. See here: press enter key in selenium
推荐答案
This can be achieved by Keys
, and Enter
.
我不了解C#的Java示例:
Example in Java as I don't know C#:
import org.openqa.selenium.Keys;
//...
// this sends an Enter to the element
selenium.type("locator", Keys.ENTER);
// or even this - this sends the "Any text" and then confirms it with Enter
selenium.type("locator", "Any text" + Keys.ENTER);
从 Keys
枚举.
From the Keys
enum.
这篇关于使用C#在Selenium RC中按Enter键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文