NavigationService extends BaseServiceHub { public void clickElementWithAttributeValue(String attributeName, String attributeValue) { By xpath = By.xpath(" WebElement element = seleniumElementService.findExpectedElement(xpath); assertTrue("The element you are trying to click (" + xpath.toString() + ") is not displayed", element.isDisplayed()); element.click(); } NavigationService(ElementService seleniumElementService); void navigate_to_url(String url); void isCurrentlyOnPage(String exectedPage); void clickElementWithAttributeValue(String attributeName, String attributeValue); void clickButtonWithText(String text); boolean isInitialPageRequested(); void mouseHoverOverElement(By locator); void windowScrollBottom(); void windowScrollTop(); void scrollElementIntoView(WebElement element);  }
@Test public void testClickElementWithAttributeValue() throws IOException { seleniumNavigationService.navigate_to_url(BUTTON_TEST_PAGE_URL); seleniumNavigationService.clickElementWithAttributeValue("title", "clickMe"); WebElement foundTextArea = seleniumElementService.findExpectedElement(By.id("buttonClickText")); assertEquals("Submit button", foundTextArea.getText()); }