Press enter key in Selenium RC using C #

How to press Enter using Selenium RC using C #?

I work SearchBoxwith help Selenium. In which I have to enter some name, and I have to click Enterto search.

There is no button Submit. Therefore I have to use Enter.

I tried something like this

selenium.KeyPress("quicksearchtextcriteria", "13");

But does not work.

Please, help.

Note. I made a set of possible ways to do this. See here: press enter key in selenium

+3
source share
7 answers

This can be achieved using the keys (click here to get C # documents on it) - and Enter .

Java, #:

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 Enum.

+5

:

import org.openqa.selenium.Keys

WebElement.sendKeys(Keys.RETURN)

:

/ Selenium

http://asynchrony.blogspot.com/2008/11/enter-key-press-in-selenium.html

, .

+3

:

selenium.KeyPressNative("13");
+1
source

I believe that you can also use the submit method. (Although I use Selenium 2, so I assume this is not possible in Selenium RC? Sorry if so).

//First you need to find the searchBox and fill it, once doing so call
searchBox.Submit();
+1
source

Here's how to do it with C #:

webElement.SendKeys (Keys.Return);

+1
source

Use this

selenium.keyDown("locator of element", "\\13");
0
source

You can use clickAt ("locator", ""); If keyPress doesn't work. This will work for sure.

0
source

All Articles