Skip to content
Taisiia-Kozlova edited this page Nov 7, 2017 · 3 revisions

Link – the element that specifies relationship between the current document and some external resource. Click on a link may lead to various events including download of a file and opening a new web-page in the same or new browser-tab.

Example:

Link

Here is the list of available methods.

Method Description Return Type
click() Click on link void
getURL() Get link destination URL
getReference() Get link destination String
waitReference(String) Wait while link destination contains expected text. Returns link destination String
waitMatchReference(String) Wait while link destination contains expected text. Returns link destination String
getTooltip() Get links tooltip String

Initialization:

@FindBy(xpath = "//link xpath")
public Link link;

Action > Examples:

@Test
public void clickLinkExample() {
    link.click();
}


@Test
public void getLinkReferenceExample() {
    String expected = "link URL";
    String actual = link.getReference();
    Assert.assertEquals(actual, expected);
}

@Test
public void getLinkTooltipExample() {
    String expected = "link tooltip";
    String actual = link.getTooltip();
    Assert.assertEquals(actual, expected);
}

See more examples on GitHub

Clone this wiki locally