Giter Club home page Giter Club logo

seleniumutilities's Introduction

Selenium Utilities

Supporting utilities to develop automation suite with Java/Selenium. Web Automation and File Automation related basic reusable building blocks are put together for faster prototyping. Test Automation Framework as API.

Get Ready for Rapid Prototyping.

Just Add this inside pom.xml

<repositories>
  <repository>
    <id>SeleniumUtilities-mvn-repo</id>
    <url>https://raw.github.com/sahasourav123/SeleniumUtilities/mvn-repo/</url>
    <snapshots>
      <enabled>true</enabled>
      <updatePolicy>always</updatePolicy>
    </snapshots>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>automation</groupId>
    <artifactId>SeleniumUtilities</artifactId>
    <version>1.1.4</version>
  </dependency>
</dependencies>

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>3.8.1</version>
      <configuration>
        <source>1.8</source>
        <target>1.8</target>
      </configuration>
    </plugin>
  </plugins>
</build>

Example

See Example using this Utility Library. See Example to dump all element in the page.

Get Compatible Driver

Download compatible driver.exe. Place it in project folder.

Create Broswser Instance

WebDriver driver;
String url = "https://github.com/sahasourav123/SeleniumUtilities";

// Create Chrome Driver Instance with initial URL
driver = new GetDriver().chromeDriver(url);

// Create IE Driver Instance with Initial URL
driver = new GetDriver().ieDriver(url);

// Create Firefox Driver Instance without Initial URL
driver = new GetDriver().firefoxDriver();

DriverSupport Object handles interaction with WebElement

DriverSupport support = new DriverSupport(driver);

Rapid Data Entry Object (Wrapper on DriverSupport Class)

DriverAction action = new DriverAction(driver);

SendKeys, SelectDropdownOption & SelectRadioButton using DriverAction (all One-liner)

action.setText(Locator.Name, "first_name", "Sourav");
action.selectDropdownOption(Locator.Name, "state", "Texas");
action.selectRadioOption(Locator.Name, "hosting", "No");
support.jsClick(Locator.Xpath, "//button[@type='submit']");

Take Screenshot easily

support.takeScreenShot(ScreenShotType.FullPage);

Dump all page elements

new KnowElements(driver).fetchBot();

Find a WebElement or perform an action quickly using Locator enum and :

By byElement = support.customLocator(Locator.IdStartWith, "Quote");

Check if Element present in dom

boolean isElement = support.isElement(byElement);

Click on the element if present

support.jsElement(byElement);

CustomWait object handle different types of wait on WebElement, iFrame and WindowsHandle

CustomWait wait = new CustomWait(driver);

Wait up-to specified seconds for a element and return boolean status

boolean status;
status = wait.explicitWait(8, byElement);
status = wait.waitForInvisibilityOfElement(5, Locator.IdContains, "Partial_id_of_element");
status = wait.waitForStalenessOfElement(5, Locator.Xapth, "XPath_of_element");

How the architecture looks like

Architecture

seleniumutilities's People

Contributors

dependabot[bot] avatar sahasourav123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.