/** Close the Popup window that appears on Login based on environment configuration */
  public void closeLoginPopup() {
    // Store initial timeout value before changing
    int nInitialTimeout = Framework.getTimeout();
    try {
      // Set the amount of time to wait for the popup to appear
      Framework.setTimeout(nWaitForPopup);

      // Wait for the pop-up if configured to appear in the environment
      if (waitForPopup()) {
        // Switch to the pop-up
        if (switchToPopupWindow()) {
          try {
            Logs.log.info("Switched to Login pop-up window");
            driver.close();
            switchToMainWindow();
            disposePopupWindowHandle();
            Logs.log.info("Closed Login pop-up window");
          } catch (Exception ex) {
            Screenshot.saveScreenshotAddSuffix("LoginPopupClose");
            String sError = "Could not close the Login pop-up window" + getNewLine();
            Logs.log.error(sError);
            throw new CloseWindowException(sError);
          }
        } else {
          Screenshot.saveScreenshotAddSuffix("LoginPopup");
          String sError = "Could not switch to the Login pop-up window" + getNewLine();
          Logs.log.error(sError);
          throw new SelectWindowException(sError);
        }
      }
    } finally {
      // Restore to initial timeout value
      Framework.setTimeout(nInitialTimeout);
    }
  }
 /**
  * Constructor - Page Object to initialize variables from
  *
  * @param pageObject - Page Object to initialize variables from
  */
 public Login(Framework pageObject) {
   this(pageObject.getDriver());
   set(pageObject);
 }