How to enter text other than sendKeys () in Selenium?

How to enter text other than sendKeys () in Selenium?

I want to enter text on web page and I have no idea how to do it.

driver.get(""); System.out.println(driver.getTitle());
driver.manage().window().maximize();
WebElement xpath = driver.findElement(By.sendKeys("Hello World!");

I have used "sendKeys" but it is not entering text. I have tried all the ways like using click(), enter(), sendKeys() etc but it is not working. Please suggest me any solution

Here's your code refactored. If you're going to be using xpath, you need to ensure your locator is correct for your HTML, this should work in chrome.get("");
System.println(driver.getTitle());
driver.manage().window().maximize();

WebElement xpath = driver.findElement(By.clear();
xpath.sendKeys("Hello World!"); If that doesn't work, can you paste in the HTML for the input element? Is it styled, for example is it a button?

What is the alternative for sendKeys in Selenium?

We are using the following code, to enter the value in an input tag in the application.

IWebElement element=driver.FindElement(By.Id("inputtext"));
Element.SendKeys(Keys.Enter);
As the application is not responding to this, we are trying to use the below code to enter the same value. Actions action = new Actions(driver);. Action.Click(element); action.SendKeys(Keys.Enter);
But the application is responding only to the above action.Click(). Any alternate for sendKeys()?

If the element is visible, try click() and then press keys. Eg click on the element, wait for it to be visible, then click it again and press keys.

Related Answers

How can we use the Selenium tool with HeadSpin?

Selenium is a tool that is used to automate functional testing. There are two types...

What are 5 Uses of Selenium?

Selenium is a web-automation tool that helps you to test web applications....

How can we use the Selenium tool with HeadSpin?

Selenium is a cross-browser testing automation framework w...