All Projects → klaushauschild1984 → Selenium Toys

klaushauschild1984 / Selenium Toys

Licence: gpl-3.0
Selenium Toys

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Selenium Toys

Nightwatch Boilerplate
boilerplate for nightwatch.js with selenium
Stars: ✭ 16 (+14.29%)
Mutual labels:  selenium, ui-testing
nightwatch-boilerplate
boilerplate for nightwatch.js with selenium
Stars: ✭ 16 (+14.29%)
Mutual labels:  selenium, ui-testing
jdi-light
Powerful Framework for UI Automation Testing on Java
Stars: ✭ 84 (+500%)
Mutual labels:  selenium, ui-testing
Youku Sdk Tool Woodpecker
In-app-debug tool for iOS
Stars: ✭ 600 (+4185.71%)
Mutual labels:  ui-testing
Infospider
INFO-SPIDER 是一个集众多数据源于一身的爬虫工具箱🧰,旨在安全快捷的帮助用户拿回自己的数据,工具代码开源,流程透明。支持数据源包括GitHub、QQ邮箱、网易邮箱、阿里邮箱、新浪邮箱、Hotmail邮箱、Outlook邮箱、京东、淘宝、支付宝、中国移动、中国联通、中国电信、知乎、哔哩哔哩、网易云音乐、QQ好友、QQ群、生成朋友圈相册、浏览器浏览历史、12306、博客园、CSDN博客、开源中国博客、简书。
Stars: ✭ 5,984 (+42642.86%)
Mutual labels:  selenium
Ui Testing Best Practices
The largest UI testing best practices list (last update: January 2021)
Stars: ✭ 783 (+5492.86%)
Mutual labels:  ui-testing
E2e Experiment
A demo project with Spring Boot / Angular application and e2e tests
Stars: ✭ 9 (-35.71%)
Mutual labels:  selenium
React Chaos
Chaos Engineering for your React apps.
Stars: ✭ 578 (+4028.57%)
Mutual labels:  ui-testing
Java Client
Java language binding for writing Appium Tests, conforms to Mobile JSON Wire & W3C Webdriver Protocol
Stars: ✭ 896 (+6300%)
Mutual labels:  selenium
Fluentlenium
FluentLenium is a website & mobile automation framework which extends Selenium to write reliable and resilient UI functional tests. This framework is React ready. Written and maintained by people who are automating browser-based tests on a daily basis.
Stars: ✭ 766 (+5371.43%)
Mutual labels:  selenium
Socialmanagertools Igbot
🤖 📷 Instagram Bot made with love and nodejs
Stars: ✭ 699 (+4892.86%)
Mutual labels:  selenium
Practical.cleanarchitecture
Asp.Net Core 5 Clean Architecture (Microservices, Modular Monolith, Monolith) samples (+Blazor, Angular 11, React 17, Vue 2.6), Domain-Driven Design, CQRS, Event Sourcing, SOLID, Asp.Net Core Identity Custom Storage, Identity Server 4 Admin UI, Entity Framework Core, Selenium E2E Testing, SignalR Notification, Hangfire Tasks Scheduling, Health Checks, Security Headers, ...
Stars: ✭ 639 (+4464.29%)
Mutual labels:  selenium
Python Spider
豆瓣电影top250、斗鱼爬取json数据以及爬取美女图片、淘宝、有缘、CrawlSpider爬取红娘网相亲人的部分基本信息以及红娘网分布式爬取和存储redis、爬虫小demo、Selenium、爬取多点、django开发接口、爬取有缘网信息、模拟知乎登录、模拟github登录、模拟图虫网登录、爬取多点商城整站数据、爬取微信公众号历史文章、爬取微信群或者微信好友分享的文章、itchat监听指定微信公众号分享的文章
Stars: ✭ 615 (+4292.86%)
Mutual labels:  selenium
Instagram Profilecrawl
📝 quickly crawl the information (e.g. followers, tags etc...) of an instagram profile.
Stars: ✭ 816 (+5728.57%)
Mutual labels:  selenium
Pythonspidernotes
Python入门网络爬虫之精华版
Stars: ✭ 5,634 (+40142.86%)
Mutual labels:  selenium
Gisaid Scrapper
Scrapping tool for GISAID data regarding SARS-CoV-2
Stars: ✭ 25 (+78.57%)
Mutual labels:  selenium
Xspear
Powerfull XSS Scanning and Parameter analysis tool&gem
Stars: ✭ 583 (+4064.29%)
Mutual labels:  selenium
Selenium Python
Selenium Python Bindings Documentation
Stars: ✭ 640 (+4471.43%)
Mutual labels:  selenium
Foxr
🦊 Node.js API to control Firefox
Stars: ✭ 783 (+5492.86%)
Mutual labels:  selenium
Crawl
selenium异步爬取网页图片
Stars: ✭ 13 (-7.14%)
Mutual labels:  selenium

Selenium Toys Build Status

This project provides a rich toolbox for easy writing Selenium test cases.

Components

Selenium Toys are currently divided into two parts:

  • core
    • Quality Gate
  • testfacade
    • Quality Gate

core contains all parts for simple handling Selenium WebDriver. At testfacade you find test backend integrations and a small but effective API for executing tests and expecting the results.

Child's play example

import static org.openqa.selenium.remote.BrowserType.CHROME;

import org.openqa.selenium.toys.RunWithWebDriver;
import org.openqa.selenium.toys.WebDriverEntryPoint;
import org.openqa.selenium.toys.testng.SeleniumTestNGTests;
import org.openqa.selenium.By;
import org.testng.annotations.Test;

@RunWithWebDriver(value = CHROME)
@WebDriverEntryPoint("http://www.google.com")
public class GoogleTest extends SeleniumTestNGTests {

  @Test
  public void calculatorTest() {
    type("2+2") //
        .on(By.id("lst-ib")) //
        .submit();

    expect(By.id("cwtltblr")) //
        .hasText("5");
  }

}

The above code demonstrates the easy usage. For setup just extend SeleniumTests and annotate your test with @Webdriver and @EntryPoint. This annotations define the use selenium web driver and entry point of the test case. The specified web driver will be automatically downloaded and installed. For further details see the corresponding javadoc of the web driver factory. There are a set of common settings for each web driver and each web driver factory can gives you the opportunity to make web driver specific configurations.

Within the test you have access to a fluently designed api for writing readable tests. In this case Google will be opened and its calculator capabilities are tested. We type 2+2 into the input field and expect stupidly 5 as the result.

Maven integration

To use Selenium Toys just add the following repository and dependency to you pom.xml:

<project>
...
  <dependencies>
    <dependency>
      <groupId>org.seleniumhq.selenium-toys</groupId>
      <artifactId>testfacade</artifactId>
      <version>2.0</version>
    </dependency>
  </dependencies>
  ...
  <repositories>
    <repository>
      <id>selenium-toys-repo</id>
      <name>Selenium Toys Repository</name>
      <url>https://raw.githubusercontent.com/klaushauschild1984/selenium-toys/mvn-repo/</url>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>always</updatePolicy>
      </snapshots>
    </repository>
  </repositories>
...
</project>

Supported test backends

There is no hard dependency to only one test backend like TestNG or JUnit. Extend and use SeleniumTestNGTests if you prefer TestNG. Extend and use SeleniumJUnit4Tests if you are a JUnit4 guy.

Take screenshots

Writing maintainable UI tests is one big part. Defining expectations is the other big one. Selenium Toy provide through Selenium functionality for DOM based text expectations. If you will go further and expect layout and UI behavior it is nearly impossible to formulate those expectations.

In the first place just add the @TakeScreenshots annotation to your test and for every test step a screenshot will be taken. If an assertion fails the causing situation is also documented via an additional screenshot named XXX-failure.png.

In addition you can enable the comparison to already existing screenshots. If so at every test step a screenshot is taken and compared to an already existing screenshot. The comparison is calculated by counting the different pixel within the two images. If the threshold is surpassed the test will fail. Two addition files XXX-new.png and XXX-diff.png will be generated to help you figuring out the problem.

Supported WebDrivers

The @RunWithWebDriver annotation specifies the used web driver for the annotated test case. The extended test bridge performs the complete Selenium setup and configuration of the web driver. There is a attribute options which you can provide additional web driver configurations.

  • RunWithWebDriver.IMPLICITLY_WAIT

    Specifies the amount of milliseconds the driver should wait when searching for an element if it is not immediately present.

  • AbstractDownloadingWebDriverFactory.EXPECTED_VERSION

    With this option you can specify the version of the executable if you need. Omit this option and the latest version of the executable will be downloaded and used.

  • AbstractDownloadingWebDriverFactory.WORK_DIRECTORY

    Via this option the working directory for the web driver is specified. There will be the executable located and if not present then downloaded. Leave it unspecified to use the systems temporary directory.

  • AbstractDownloadingWebDriverFactory.FORCE_UPDATE

    If there is already a local copy of the web driver executable this option controls if a check for an available newer version and if present a download is performed.

Chrome - BrowserType.CHROME

The web driver for Google Chrome.

Custom web driver factory

You can implement you own WebdriverFactory to provide support an not included web driver. After the implementation the class has to be registered at DelegatingWebdriverFactory. Every web driver factory is determined by its supported browser type. Only one per type is allowed. But there is the possibility to override already registered factories. The last registered factory will be used. At all cost you have to manage the the factory registration happens before any test will be executed. Otherwise the test setup will fail.

Modularize tests

There is a concept of modularization. Maybe you working on a test suite for a rich web application. It is possible to have similar test steps in many tests. To prevent code duplications and help maintain your tests use SeleniumModule. By extending this class you are provided with the same api for test steps. The example below modularize the usage example. Best practice is that a module has one method that performs the test steps. Within the test you have to use it nd perform its action.

import static org.openqa.selenium.remote.BrowserType.CHROME;

import org.openqa.selenium.toys.RunWithWebDriver;
import org.openqa.selenium.toys.WebDriverEntryPoint;
import org.openqa.selenium.toys.testng.SeleniumTestNGTests;
import org.openqa.selenium.toys.SeleniumModule;
import org.openqa.selenium.By;
import org.testng.annotations.Test;

@RunWithWebDriver(value = CHROME)
@WebDriverEntryPoint("http://www.google.com")
public class SeleniumModuleTest extends SeleniumTestNGTests {

  @Test
  public void calculatorTest() {
    use(new GoogleSearch()).typeAndSubmit("2+2");

    use(new GooleSearchResult()).expect("4");
  }

  static class GoogleSearch extends SeleniumModule {

    void typeAndSubmit(final String text) {
      type(text) //
          .on(By.id("lst-ib")) //
          .submit();
    }

  }

  static class GooleSearchResult extends SeleniumModule {

    void expect(final String text) {
      expect(By.id("cwtltblr")) //
          .hasText(text);
    }

  }

}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].