edu.samplu.common
Class WebDriverUtil

java.lang.Object
  extended by edu.samplu.common.WebDriverUtil

public class WebDriverUtil
extends Object

The goal of the WebDriverUtil class is to invert the dependencies on WebDriver from WebDriverLegacyITBase for reuse without having to extend WebDriverLegacyITBase. For the first example see waitFor

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
WebDriverLegacyITBase

Field Summary
static int DEFAULT_IMPLICIT_WAIT_TIME
          TODO apparent dup WebDriverITBase.DEFAULT_WAIT_SEC TODO parametrize for JVM Arg 30 Seconds
static String PROXY_HOST_PROPERTY
          local proxy used for running tests thru jmeter.
static String REMOTE_DRIVER_SAUCELABS_PROPERTY
          Set -Dremote.driver.saucelabs for running on saucelabs
static String REMOTE_PUBLIC_CHROME
          Set -Dremote.public.chrome= or WEBDRIVER_CHROME_DRIVER
static int SETUP_URL_LOAD_WAIT_SECONDS
          Time to wait for the URL used in setup to load.
static int SHORT_IMPLICIT_WAIT_TIME
          TODO introduce SHORT_IMPLICIT_WAIT_TIME with param in WebDriverITBase TODO parametrize for JVM Arg 1 Second
static String WEBDRIVER_CHROME_DRIVER
          Selenium's webdriver.chrome.driver parameter, you can set -Dwebdriver.chrome.driver= or Rice's REMOTE_PUBLIC_CHROME
 
Constructor Summary
WebDriverUtil()
           
 
Method Summary
static void checkForIncidentReport(org.openqa.selenium.WebDriver driver, String locator, Failable failable, String message)
           
static org.openqa.selenium.chrome.ChromeDriverService chromeDriverCreateCheck()
           
static String deLinespace(String contents)
           
static String determineUser(String testParam)
           
static void failOnMatchedJira(String contents, Failable failable)
           
static org.openqa.selenium.WebDriver getWebDriver()
          remote.public.driver set to chrome or firefox (null assumes firefox) if remote.public.hub is set a RemoteWebDriver is created (Selenium Grid) if proxy.host is set, the web driver is setup to use a proxy
static void login(org.openqa.selenium.WebDriver driver, String userName, Failable failable)
          If the JVM arg remote.autologin is set, auto login as admin will not be done.
protected static void selectFrameSafe(org.openqa.selenium.WebDriver driver, String locator)
           
static org.openqa.selenium.WebDriver setUp(String username, String url)
          Setup the WebDriver test, login, and load the given web page
static org.openqa.selenium.WebDriver setUp(String username, String url, String className, String testName)
          Setup the WebDriver test, login, and load the given web page
static void tearDown(boolean passed, String sessionId, String testParam, String userParam)
           
static void waitFor(org.openqa.selenium.WebDriver driver, int waitSeconds, org.openqa.selenium.By by, String message)
          Wait for the given amount of seconds, for the given by, using the given driver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_IMPLICIT_WAIT_TIME

public static int DEFAULT_IMPLICIT_WAIT_TIME
TODO apparent dup WebDriverITBase.DEFAULT_WAIT_SEC TODO parametrize for JVM Arg 30 Seconds


SHORT_IMPLICIT_WAIT_TIME

public static int SHORT_IMPLICIT_WAIT_TIME
TODO introduce SHORT_IMPLICIT_WAIT_TIME with param in WebDriverITBase TODO parametrize for JVM Arg 1 Second


REMOTE_DRIVER_SAUCELABS_PROPERTY

public static final String REMOTE_DRIVER_SAUCELABS_PROPERTY
Set -Dremote.driver.saucelabs for running on saucelabs

See Also:
Constant Field Values

WEBDRIVER_CHROME_DRIVER

public static final String WEBDRIVER_CHROME_DRIVER
Selenium's webdriver.chrome.driver parameter, you can set -Dwebdriver.chrome.driver= or Rice's REMOTE_PUBLIC_CHROME

See Also:
Constant Field Values

REMOTE_PUBLIC_CHROME

public static final String REMOTE_PUBLIC_CHROME
Set -Dremote.public.chrome= or WEBDRIVER_CHROME_DRIVER

See Also:
Constant Field Values

SETUP_URL_LOAD_WAIT_SECONDS

public static final int SETUP_URL_LOAD_WAIT_SECONDS
Time to wait for the URL used in setup to load. Sometimes this is the first hit on the app and it needs a bit longer than any other. 120 Seconds. TODO parametrize for JVM Arg

See Also:
Constant Field Values

PROXY_HOST_PROPERTY

public static final String PROXY_HOST_PROPERTY
local proxy used for running tests thru jmeter. Include host name and port number. Example: localhost:7777

See Also:
Constant Field Values
Constructor Detail

WebDriverUtil

public WebDriverUtil()
Method Detail

setUp

public static org.openqa.selenium.WebDriver setUp(String username,
                                                  String url)
                                           throws Exception
Setup the WebDriver test, login, and load the given web page

Parameters:
username -
url -
Returns:
driver
Throws:
Exception

setUp

public static org.openqa.selenium.WebDriver setUp(String username,
                                                  String url,
                                                  String className,
                                                  String testName)
                                           throws Exception
Setup the WebDriver test, login, and load the given web page

Parameters:
username -
url -
className -
testName -
Returns:
driver
Throws:
Exception

tearDown

public static void tearDown(boolean passed,
                            String sessionId,
                            String testParam,
                            String userParam)
                     throws Exception
Parameters:
passed -
sessionId -
testParam -
userParam -
Throws:
Exception

determineUser

public static String determineUser(String testParam)
Parameters:
testParam -
Returns:

checkForIncidentReport

public static void checkForIncidentReport(org.openqa.selenium.WebDriver driver,
                                          String locator,
                                          Failable failable,
                                          String message)
Parameters:
driver -
locator -
message -

chromeDriverCreateCheck

public static org.openqa.selenium.chrome.ChromeDriverService chromeDriverCreateCheck()
Returns:
chromeDriverService

getWebDriver

public static org.openqa.selenium.WebDriver getWebDriver()
remote.public.driver set to chrome or firefox (null assumes firefox) if remote.public.hub is set a RemoteWebDriver is created (Selenium Grid) if proxy.host is set, the web driver is setup to use a proxy

Returns:
WebDriver or null if unable to create

login

public static void login(org.openqa.selenium.WebDriver driver,
                         String userName,
                         Failable failable)
                  throws InterruptedException
If the JVM arg remote.autologin is set, auto login as admin will not be done.

Parameters:
driver -
userName -
failable -
Throws:
InterruptedException

selectFrameSafe

protected static void selectFrameSafe(org.openqa.selenium.WebDriver driver,
                                      String locator)

waitFor

public static void waitFor(org.openqa.selenium.WebDriver driver,
                           int waitSeconds,
                           org.openqa.selenium.By by,
                           String message)
                    throws InterruptedException
Wait for the given amount of seconds, for the given by, using the given driver. The message is displayed if the by cannot be found. No action is performed on the by, so it is possible that the by found is not visible or enabled.

Parameters:
driver - WebDriver
waitSeconds - int
by - By
message - String
Throws:
InterruptedException

failOnMatchedJira

public static void failOnMatchedJira(String contents,
                                     Failable failable)

deLinespace

public static String deLinespace(String contents)


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.