How to specify "ENTER" button functionality in Selenium WebDriver code?

selenium

I'm figuring out a way to hit the "Enter" key in Selenium. Unfortunately the form I'm trying to test doesn't have a Submit button. Neither can I modify it since it is not my own code.

When working with it manually, I hit the "ENTER" button via keyboard. I need to know how to do that with the Selenium typecommand as there is no button to click.

1
Answers

Replies

The following is the code to specify the enter button functionality in Selenium WebDriver code.


using OpenQA.Selenium.Interactions;


Actions builder = new Actions(driver);        

builder.SendKeys(Keys.Enter);
 
 

If you want to unleash your potential in this competitive field, please visit the selenium course page for more information, where you can find the selenium tutorials and selenium frequently asked interview questions and answers as well.

 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.