Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8001369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:04:37+00:00 2026-06-04T16:04:37+00:00

I am using Selenium Server (v2.21) and Selenium Java Client (v.2.21.0) to automate a

  • 0

I am using Selenium Server (v2.21) and Selenium Java Client (v.2.21.0) to automate a web form that needs to have the Enter key pressed after each entry, since fields are exposed based on the value entered. So based on the solution here, I’ve been trying different ways to enter a string into the form and press Enter – here are the ones that I’ve tried:

// type field value
selenium.type("program", "MIC HOMEOWNERS");

// ** not working: selenium.keyPress("program", "\\13");
// ** not working: selenium.select("program", "Program");
// ** not working: selenium.keyPressNative(Keys.ENTER.toString());
// ** not working: selenium.keyDown("program", "13");

It would seem like this is the most logical solution (selenium.keyPressNative(Keys.ENTER)), but the compiler throws an error if you don’t add the .toString, since keyPressNative is expecting a String.

The actual form code:

<label  >Program</label> 
    <input id="program" name="program1" class="readonly-bg" readonly="readonly" type="text" value="MIC HOMEOWNERS" size="12"/>
    <input id="program" name="program" type="hidden" value="601"/>
        <script type="text/javascript">  
            Spring.addDecoration(new Spring.ElementDecoration({  
                elementId : "program",  
                widgetType : "dijit.form.ValidationTextBox",  
                widgetAttrs : { 
                    trim:true ,
                    required : true
                }}));  
        </script>
<br>

How do I emulate the press of the Enter key?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:04:38+00:00Added an answer on June 4, 2026 at 4:04 pm

    I am using the following code to click the Escape or Enter.

    try {
        Thread.sleep(700);
    } catch (InterruptedException e) {
        selenium.keyPressNative("27"); // Escape
        selenium.keyPressNative("10"); // Enter 
    }   
    

    we need to pause the selenium till previous command get executed successfully. So I am using the sleep() method. For my test case, I required to pause for 700 MillSec. Bases on your requirement you need to change the value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried Selenium 2.0 (documentation says it's using WebDriver) as so: java -jar selenium-server-standalone-2.0a1.jar
I want to run a selenium tests using python against a server farm that
I am trying to run Selenium Server using a network path as follows: java
Background: I have a Flex web app that communicates with a Java back-end via
Running a Selenium 2 RemoteWebDriver server using java -jar selenium-server-standalone-2.15.0.jar . I always get
I using PHPUnit and Selenium Server to testing Yii Application, but whenever i tried
I'm using Selenium WebDriver with Java. I want to use Safari browser. Does Selenium
I'm using Selenium for work and I have extract some data from //ul, unfortunately
I'm using Selenium 2.0 web driver. My script fails occasionally whenever I try locating
I'm trying to run Selenium RC 1.0.3 using Java 6, JUnit 4, and Eclipse

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.