Skip to content

Encapsulates selenium functionalities from pages or test suites.

License

Notifications You must be signed in to change notification settings

sercanparker/selenium-capsule

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

selenium-capsule

Encapsulates selenium functionalities from pages or test suites.
Alt text

💁 Installation

Maven

check here : https://github.com/sercanparker/selenium-capsule/packages/180938

<dependency>
  <groupId>com.selenium-capsule</groupId>
  <artifactId>selenium-capsule</artifactId>
  <version>1.0.0</version>
</dependency>

🙇 Usage

check here : https://github.com/sercanparker/selenium-capsule/blob/master/src/test/java/TestGoogle.java

System.setProperty("webdriver.chrome.driver","PATH_OF_DRIVER");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.google.com/");
seleniumCapsule = new SeleniumCapsule(driver,5);
ClickEvent clickEvent = seleniumCapsule.clickWithXpath("(//input[@name=\"btnI\"])[2]");
Assert.assertTrue(clickEvent.isSuccess());
//you can log these messages based on operation success.
//clickEvent.getInformationMessage();
//clickEvent.getErrorMessage();
//clickEvent.getInnerExceptionMessage();
EnterTextEvent enterTextEvent = seleniumCapsule.enterTextWithXpath("selenium", "//input[@type=\"foo\"]");
Assert.assertTrue(!enterTextEvent.isSuccess());
Assert.assertNotNull(enterTextEvent.getInnerExceptionMessage());
Assert.assertTrue(!enterTextEvent.getInnerExceptionMessage().isEmpty());
Assert.assertNotNull(enterTextEvent.getErrorMessage());
Assert.assertTrue(!enterTextEvent.getErrorMessage().isEmpty());
GetTextEvent getTextEvent = seleniumCapsule.getTextWithXpath("//a[text() = \"Gmail\"]");
Assert.assertTrue(getTextEvent.isSuccess());
Assert.assertEquals(getTextEvent.getParameter(), "Gmail");

About

Encapsulates selenium functionalities from pages or test suites.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 2

  •  
  •  

Languages