/** Close the current window */ protected void closeWindow() throws SAFSException { setFocusToWindow(); selenium.close(); testRecordData.setStatusCode(StatusCodes.NO_SCRIPT_FAILURE); String msg = genericText.convert( "success3", windowName + ":" + compName + " " + action + " successful.", windowName, compName, action); log.logMessage(testRecordData.getFac(), msg, PASSED_MESSAGE); selenium.stop(); // closes FF browser, but not IE6 SApplicationMap.removeSelenium(windowName); }
public void process() { String debugmsg = this.getClass().getName() + ".process(): "; // assume this for now.. sHelper = (STestRecordHelper) testRecordData; try { selenium = SApplicationMap.getSelenium(sHelper.getWindowName()); } catch (SAFSException e) { selenium = SApplicationMap.getSelenium(""); } testRecordData.setStatusCode(StatusCodes.SCRIPT_NOT_EXECUTED); try { getHelpers(); sUtils = (SeleniumGUIUtilities) utils; } catch (SAFSException ex) { testRecordData.setStatusCode(StatusCodes.GENERAL_SCRIPT_FAILURE); log.logMessage( testRecordData.getFac(), "SAFSException: " + ex.getClass().getName() + ", msg: " + ex.getMessage(), FAILED_MESSAGE); return; } winObject = sHelper.getWindowTestObject(); compObject = sHelper.getCompTestObject(); if (winObject == null) { Log.warn(debugmsg + " Window Object is null, try to get it through SeleniumGUIUtility. "); try { if (sUtils.waitForObject(mapname, windowName, windowName, secsWaitForWindow) == 0) { Log.debug(debugmsg + " we got the window object through SeleniumGUIUtility."); winObject = ((STestRecordHelper) testRecordData).getWindowTestObject(); } else { Log.debug( debugmsg + " can not get window object through SeleniumGUIUtility: waitForObject() error."); } } catch (SAFSObjectNotFoundException e) { Log.debug( debugmsg + " can not get window object through SeleniumGUIUtility: Exception=" + e.getMessage()); } if (winObject == null) { Log.error(debugmsg + " Window Object is still null"); testRecordData.setStatusCode(StatusCodes.GENERAL_SCRIPT_FAILURE); log.logMessage( testRecordData.getFac(), action + " failed, due to 'Window Object is null'", FAILED_MESSAGE); return; } } if (compObject == null) { Log.warn(debugmsg + " Component Object is null, try to get it through SeleniumGUIUtility."); if (!windowName.equals(compName)) { try { if (sUtils.waitForObject(mapname, windowName, compName, secsWaitForWindow) == 0) { Log.debug(debugmsg + " we get the component object through SeleniumGUIUtility."); compObject = ((STestRecordHelper) testRecordData).getCompTestObject(); } else { Log.debug( debugmsg + " can not get component object through SeleniumGUIUtility: waitForObject() error."); } } catch (SAFSObjectNotFoundException e) { Log.debug( debugmsg + " can not get component object through SeleniumGUIUtility: Exception=" + e.getMessage()); } if (compObject == null) { Log.warn(debugmsg + " Component Object is still null."); } } } // updateFromTestRecordData();//why this is commented? // do the work localProcess(); if (testRecordData.getStatusCode() == StatusCodes.SCRIPT_NOT_EXECUTED) { componentProcess(); // handle Generic keywords } else { Log.debug(debugmsg + " processed " + testRecordData); Log.debug(debugmsg + " params " + params); } }