/** * Converts a user interactions transition to a list of Selenium commands. * * @param transition The transition to convert. */ public void handleUserInteractions( SeleniumHolder seleniumHolder, UserInteractionsTransition transition) { for (UserInteraction userInteraction : transition.getUserInteractions()) { IActionElement actionElement = userInteraction.getElement(); if (actionElement == null) { Logger.warn("Action element was null. Skipping user interaction: " + userInteraction); continue; } int waitMillis = seleniumHolder.getNextPageElementTimeout() * 1000; int waitIntervalMillis = 100; int i = 0; while (true) { try { handleUserInteraction(seleniumHolder, userInteraction); break; } catch (UserInteractionException e) { if (i > waitMillis) { handleUserInteractionFailure(seleniumHolder, userInteraction, e); } try { Thread.sleep(waitIntervalMillis); i += waitIntervalMillis; Logger.warn( "Retrying user interaction: " + userInteraction.toString() + " after error: " + ErrorHandler.getCause(e).toString()); } catch (InterruptedException e2) { throw new ExporterException(e2.toString() + " came after " + e.toString(), e); } } } // increment the number of steps in test: seleniumHolder.addResult(null, TestPartStatus.PASS); } if (transition.hasCustomTimeout()) { seleniumHolder.setNextPageElementTimeout(transition.getSecondsToWaitForResult()); } }