I am using selenium 3.6.0. and I run some basic test (login to the Stackoverflow page). But, when I am sending email, character "@" is not passed. Instead of it, it looks like for me that it puts some values from buffer.
package Cucumerframework.steps;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.junit.Assert;
import cucumber.api.java.Before;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class StepsClass {
WebDriver driver;
@Before()
public void setup() {
System.setProperty("webdriver.chrome.driver",
"C:\Users\WCodeKemalK\Cucumber\Cucumerframework\target\test-classes\Resources\chromedriver.exe");
this.driver = new ChromeDriver();
this.driver.manage().window().maximize();
this.driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS);
}
@Given("^User navigates to stackoverflow website$")
public void user_navigates_to_stackoverflow_website() throws Throwable {
driver.get("https://stackoverflow.com/");
}
@Given("^User clicks on the login button on homepage$")
public void user_clicks_on_the_login_button_on_homepage() throws Throwable {
driver.findElement(By.xpath("/html/body/header/div/ol[2]/li[2]/a[1]")).click();
}
@Given("^User enters a valid username$")
public void user_enters_a_valid_username() throws Throwable {
driver.findElement(By.xpath("//*[@id="email"]")).sendKeys("[email protected]");
}
@Given("^User enters a valid password$")
public void user_enters_a_valid_password() throws Throwable {
driver.findElement(By.xpath("//*[@id="password"]")).sendKeys("xxxxxxx");
}
@When("^User clicks on the login button$")
public void user_clicks_on_the_login_button() throws Throwable {
driver.findElement(By.xpath("//*[@id="submit-button"]")).click();
}
@Then("^User should be taken to the successful login page$")
public void user_should_be_taken_to_the_successful_login_page() throws Throwable {
Thread.sleep(3000);
WebElement askQuestionsButton = driver.findElement(By.xpath("//a[contains (text(), Ask Question)]"));
Assert.assertEquals(true, askQuestionsButton.isDisplayed());
}
}
Here is what I get:
https://ibb.co/k35WL3N
question from:
https://stackoverflow.com/questions/65893021/sendkeys-does-not-pass-the-character 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…