Ejemplo n.º 1
0
  /** This method stops LoggingSelenium session and sets its instance to null. */
  public void stopSeleniumInstance() {
    // Comment these lines just for UrgentWowyTest
    /*logger.info("Taking screen shot before closing selenium instance");
    if (lastTestMethodResult == true) captureScreenShot(selenium, currentScreenShotPath);*/

    try {

      logger.info("Clicking on 'Sign Out' if not signed out");
      // if(selenium.isElementPresent("css=a:contains(Sign Out)")) {
      if (selenium.isTextPresent("Sign Out")) {
        selenium.click("css=a:contains(Sign Out)");
        selenium.waitForPageToLoad(TestConsts.PAGE_LOAD_TIMEOUT);
      }
    } catch (Exception e) {
      logger.info(e.getMessage());
    }

    logger.info("Setting sign  in count to 0");
    signInCount = 0;

    try {
      logger.info("Stopping selenium session");
      selenium.stop();
      logger.info("Setting selenium Instance as null");
      selenium = null;

      if (null != loggingWriter) {
        loggingWriter.close();
        loggingWriter = null;
      }
    } catch (Exception e) {
      // do nothing
    }
  }
Ejemplo n.º 2
0
 public boolean isTextPresent(String textToCheck) {
   for (int second = 0; ; second++) {
     if (second >= TestConsts.TIMEOUT) return false;
     try {
       if (selenium.isTextPresent(textToCheck)) return true;
     } catch (Exception e) {
     }
     sleep(1000);
   }
 }