Know Your Test Automation Tools : Working with Selenide Java

Know Your Test Automation Tools : Working with Selenide Java

Selenide is another awesome test automation API for Web UI test automation in Java. Its based on Selenium and is a wrapper. It provides following advantages;

  1. Concise fluent API for tests
  2. Ajax support for stable tests?
  3. Powerful selectors
  4. Simple configuration

To start with Selenide test automation, need to add the following dependency to your Mavan Java pom.xml

<dependency>
    <groupId>com.codeborne</groupId>
    <artifactId>selenide</artifactId>
    <version>5.23.0</version>
    <scope>test</scope>        

</dependency>
        

Next lets create a test class and add the following automation script which will help us to automate a login scenario for theGuru99 demo bank application.

import org.openqa.selenium.By;
import org.testng.Assert;
import org.testng.annotations.Test;
import static com.codeborne.selenide.Selenide.*;
import static com.codeborne.selenide.Condition.*;
public class SelenideTest {
	@Test
	public void userCanLoginByUsername() {
	? open("https://demo.guru99.com/V4/");
	? $(By.name("uid")).setValue("mngr332873");
	? $(By.name("password")).setValue("umEtyvy");
	? $(By.name("btnLogin")).click();
	? Assert.assertEquals(title(), "Guru99 Bank Manager HomePage");
	}
}
        

Now you can run the script as a TestNG test and the test case will get executed.

For more information on the Selenide commands refer the Selenide API documentation.




要查看或添加评论,请登录

Kushan Shalindra Amarasiri的更多文章

社区洞察

其他会员也浏览了