Selenium: "disable on submit"

Selenium WebDriver , . javascript, , .

?

, button.click()

, , , . - .click()

, , ; /javascript , , , - .

javascript-.

+3




1


, Esc , :

WebElement input = driver.findElement(By.tagName("input")); 
input.sendKeys(Keys.ENTER, Keys.ESCAPE);
Assert.assertFalse(input.isEnabled());

      

Enter Esc , JavaScript , . , , , , . , ; -).


( )

, ! Esc API (JavaDocs). .



, - , , ( ) , :

WebElement input = driver.findElement(By.tagName("input"));
new Actions(driver)
        .click(input)
        .sendKeys(input, Keys.ESCAPE)
        .perform();

      


: IE8 FF18 Selenium 2.29.1; Win XP SP3. :

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Test</title>
</head>
<body>
    <a href="http://google.com/">
        <input type="button" value="Hello." onclick="this.disabled='true';" />
    </a>
</body>
</html>

      

+5









All Articles