Selenium Webdriver - Trigger onchange before send all keys using SendKeys

868 views Asked by At

Chrome: Version 55.0.2883.87 m Selenium: 2.43.1

I have a textbox that input integer number. When changing it value will show a alert popup. My problem is when using sendKeys to input "12". It input "1" then trigger alert, close alert: "2" appears. Expectation must be: input "12" properly without alert.

Anyone can help? Thanks.

1

There are 1 answers

1
Madhan On

You can go with JavascriptExecutor

    WebElement inputElement = null;//Your WebElement
    String valueToEnter = "12";
    ((JavascriptExecutor) driver)
            .executeScript("arguments[0].value=arguments[1]",inputElement,valueToEnter);