Yandex QATools HtmlElements

WebDriver PageObject extension

License

License

GroupId

GroupId

ru.sbtqa.htmlelements
ArtifactId

ArtifactId

htmlelements
Last Version

Last Version

1.17-JAVA7
Release Date

Release Date

Type

Type

pom
Description

Description

Yandex QATools HtmlElements
WebDriver PageObject extension
Project URL

Project URL

https://github.com/yandex-qatools/htmlelements/
Project Organization

Project Organization

Yandex
Source Code Management

Source Code Management

https://github.com/sbtqa/htmlelements/tree/master

Download htmlelements

How to add to project

<!-- https://jarcasting.com/artifacts/ru.sbtqa.htmlelements/htmlelements/ -->
<dependency>
    <groupId>ru.sbtqa.htmlelements</groupId>
    <artifactId>htmlelements</artifactId>
    <version>1.17-JAVA7</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/ru.sbtqa.htmlelements/htmlelements/
implementation 'ru.sbtqa.htmlelements:htmlelements:1.17-JAVA7'
// https://jarcasting.com/artifacts/ru.sbtqa.htmlelements/htmlelements/
implementation ("ru.sbtqa.htmlelements:htmlelements:1.17-JAVA7")
'ru.sbtqa.htmlelements:htmlelements:pom:1.17-JAVA7'
<dependency org="ru.sbtqa.htmlelements" name="htmlelements" rev="1.17-JAVA7">
  <artifact name="htmlelements" type="pom" />
</dependency>
@Grapes(
@Grab(group='ru.sbtqa.htmlelements', module='htmlelements', version='1.17-JAVA7')
)
libraryDependencies += "ru.sbtqa.htmlelements" % "htmlelements" % "1.17-JAVA7"
[ru.sbtqa.htmlelements/htmlelements "1.17-JAVA7"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • htmlelements-java
  • htmlelements-matchers
  • htmlelements-thucydides
  • htmlelements-all

Html Elements framework

[release] (https://github.com/yandex-qatools/htmlelements/releases/latest) [Maven Central] (https://maven-badges.herokuapp.com/maven-central/ru.yandex.qatools.htmlelements/htmlelements-java)

This framework is designed to provide an easy-to-use way of interacting with web-page elements in your tests. It can be considered to be an extension of WebDriver Page Object.

With the help of the Html Elements framework you can group web-page elements into blocks, encapsulate logic of interaction within them and then easily use created blocks in page objects. It also provides a set of helpful matchers to use with web-page elements and blocks. See [JavaDocs] (https://oss.sonatype.org/service/local/repositories/releases/archive/ru/yandex/qatools/htmlelements/htmlelements-java/1.16/htmlelements-java-1.16-javadoc.jar/!/index.html) and Samples for more details.

You can ask your questions on StackOverflow with the [![htmlelements] (https://img.shields.io/badge/stackoverflow-htmlelements-orange.svg?style=flat)] (http://stackoverflow.com/questions/tagged/htmlelements) tag.

Other Languages

In case you are not a Java guy/gal, don't panic, there are still few options:

Release Notes

Include Html Elements in your project

Maven dependencies for Html Elements core:

<dependency>
    <groupId>ru.yandex.qatools.htmlelements</groupId>
    <artifactId>htmlelements-java</artifactId>
    <version>1.17</version>
</dependency>

And for Thucydides integration:

<dependency>
    <groupId>ru.yandex.qatools.htmlelements</groupId>
    <artifactId>htmlelements-thucydides</artifactId>
    <version>1.17</version>
</dependency>

Or you can include all modules at once if needed:

<dependency>
    <groupId>ru.yandex.qatools.htmlelements</groupId>
    <artifactId>htmlelements-all</artifactId>
    <version>1.17</version>
</dependency>

Since 1.15 Java 8 is required. Please use 1.14 for Java 7 support.

Create blocks of elements

For example, let's create a block for the search form on the page http://www.yandex.com:

@Name("Search form")
@FindBy(xpath = "//form")
public class SearchArrow extends HtmlElement {

    @Name("Search request input")
    @FindBy(id = "searchInput")
    private TextInput requestInput;

    @Name("Search button")
    @FindBy(className = "b-form-button__input")
    private Button searchButton;

    public void search(String request) {
        requestInput.sendKeys(request);
        searchButton.click();
    }
}

Construct page object using created blocks

You can easily use created blocks in page objects:

public class SearchPage {

    private SearchArrow searchArrow;
    // Other blocks and elements here ...

    public SearchPage(WebDriver driver) {
        PageFactory.initElements(new HtmlElementDecorator(new HtmlElementLocatorFactory(driver)), this);
    }

    public void search(String request) {
        searchArrow.search(request);
    }

    // Other methods here ...
}

Use page objects in your tests

Created page objects can be used in your tests. This makes tests more concise, easier to maintain, and easy to write.

public class SampleTest {

    private WebDriver driver = new FirefoxDriver();
    private SearchPage searchPage = new SearchPage(driver);

    @Before
    public void loadPage() {
        driver.get("http://www.yandex.com");
    }

    @Test
    public void sampleTest() {
        searchPage.search("yandex");
        // Some assertion here
    }

    @After
    public void closeDriver() {
        driver.quit();
    }
}

Questions?

In case you can't find an answer in documentation and examples provided above, you can ask it on StackOverflow with the htmlelements tag.

ru.sbtqa.htmlelements

Test Automation Gears

Versions

Version
1.17-JAVA7