M
M
Ms123412342021-07-21 20:02:54
Java
Ms12341234, 2021-07-21 20:02:54

Selenium sendKeys operator not working, what is the reason?

Using IntelliJ IDEA, I set an autotest, and text should be entered in the element, but it is not entered, using the sendKeys operator.

Construction -

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

import java.nio.charset.StandardCharsets;
import java.time.Duration;

public class FirstTest {
@Test
public void firstTest() {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\79259\\Desktop\\Testing\\Soft\\chromedriver.exe");
ChromeDriver driver = new ChromeDriver();
driver.get("https://yandex.ru ");
WebElement element = driver.findElement(By.xpath(".input__control input__input mini-suggest__input"));
element.sendKeys("Hi!");
}
}

When doing element.click( ) - the field is highlighted, but I try to make text and nothing happens...
Google selenium driver matches the version of Google browser.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2021-07-21
@Ms12341234

.input__control input__input mini-suggest__input
Your selector is incorrect
, it should look like this:
.input__control.input__input.mini-suggest__input

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question