ch.inftec.ju.ee.webtest.WebTestUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ju-testing-ee Show documentation
Show all versions of ju-testing-ee Show documentation
Contains helping classes for Unit Testing, supporting CDI and EE features, including DB access
package ch.inftec.ju.ee.webtest;
import org.openqa.selenium.WebDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ch.inftec.ju.util.JuUtils;
import ch.inftec.ju.util.PropertyChain;
/**
* Utility class containing web test helper methods.
* @author Martin
*
*/
public class WebTestUtils {
private static Logger logger = LoggerFactory.getLogger(WebTestUtils.class);
/**
* Opens the specified page. The page URL must be specified without host and port,
* e.g. web-app/page.jsf
. Host name and port will be resolved from the
* JU properties, e.g. http://localhost:8080/web-app/page.jsf
* @param driver WebDriver to get page for
* @param pageUrl Page URL
*/
public static void getPage(WebDriver driver, String pageUrl) {
PropertyChain pc = JuUtils.getJuPropertyChain();
String host = pc.get("ju-testing-ee.web.host");
Integer port = pc.get("ju-testing-ee.web.port", Integer.class) + pc.get("ju-util-ee.portOffset", Integer.class);
String url = String.format("http://%s:%d/%s", host, port, pageUrl);
logger.debug("Getting " + url);
driver.get(url);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy