NavigationService extends BaseServiceHub { public void navigate_to_url(String url) throws IOException { if (url.startsWith(SenBotContext.RESOURCE_LOCATION_PREFIX)) { String urlLoc = getSenBotContext().getRuntimeResources() + url.replace(SenBotContext.RESOURCE_LOCATION_PREFIX, ""); if (urlLoc.startsWith("/")) { urlLoc = urlLoc.replaceFirst("/", ""); } url = "file: } getWebDriver().get(url); } 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 testNavigate_to_url() throws Exception { String pageUnderTest = "/test_pages/exampleButton.html"; seleniumNavigationService.navigate_to_url(SenBotContext.RESOURCE_LOCATION_PREFIX + pageUnderTest); SenBotContext senBotContext = SenBotContext.getSenBotContext(); String expectedUrl = senBotContext.getRuntimeResources().toString() + pageUnderTest; expectedUrl = expectedUrl.replaceAll("\\\\", "/"); if (expectedUrl.startsWith("/")) { expectedUrl = expectedUrl.replaceFirst("/", ""); } String foundUrl = senBotContext.getSeleniumDriver().getCurrentUrl(); if (foundUrl.endsWith("/")) { foundUrl = foundUrl.substring(0, foundUrl.length() - 1); } assertEquals("file: }