Selenide
Posted by Bruce Tsai
07/22/2016
Selenide 是基於 Selenium WebDriver 的 web 自動化測試工具。Selenide 簡化了在 web 上測試的流程,並提供了極為簡練的 API,讓 web 的測試能夠輕易的達成。
範例
@Test
public void canFillComplexForm() {
open("/client/registration");
$(By.name("user.name")).val("johny");
$(By.name("user.gender")).selectRadio("male");
$("#user.preferredLayout").selectOption("plain");
$("#user.securityQuestion").selectOptionByText("What is my first car?");
}
- Ajax support
$("#topic").should(appear);
$("#topic").shouldBe(visible);
$("#topic").should(disappear);
$("h1").shouldHave(text("Hello"));
$(".message").shouldNotHave(text("Wait for loading..."));
$(".password").shouldNotHave(cssClass("errorField"));
$(".error").should(disappear);