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

Image – simply a graphical element, residing on a web page. Various pictures, logos or photos may be categorized as images. Images, being rather substantive elements, may be subjects of limited number of actions. Usually, you would only wish to click on them, or get their source, or perhaps view the tip, if any is available.

Example:

Image

Here is the list of available methods.

Method Description Return Type
click() Click on image void
getSource() Get image source String
getTip() Get image tip/alt/hint text String

Initialization:

@FindBy(xpath = "//image xpath")
public Image image;

Action > Examples:

@Test
public void getImageSourceExample() {
    String expected = "image source";
    String actual = image.getSource();
    Assert.assertEquals(actual, expected);
}

@Test
public void getImageTipExample() {
    String expected = "image tip";
    String actual = image.getTip();
    Assert.assertEquals(actual, expected);
}

See more examples on GitHub

Clone this wiki locally