private void RunCommand() { try { this.commandResult = this.command.Apply(this.driver, this.args); } catch (SeleniumException e) { this.thrownException = e; } }
private void RunCommand() { try { this.commandResult = this.command.Apply(this.driver, this.args); } catch (SeleniumException e) { this.thrownException = e; } catch (WebDriverException e) { this.thrownException = new SeleniumException("WebDriver exception thrown", e); } catch (InvalidOperationException e) { this.thrownException = new SeleniumException("WebDriver exception thrown", e); } }
/// <summary> /// Executes a command. /// </summary> /// <param name="commandToExecute">The <see cref="SeleneseCommand"/> to execute.</param> /// <param name="commandDriver">The <see cref="IWebDriver"/> to use in executing the command.</param> /// <param name="commandArguments">An array of strings containng the command arguments.</param> /// <returns>The result of the command.</returns> /// <remarks>This method executes the command on a separate thread.</remarks> public object Execute(SeleneseCommand commandToExecute, IWebDriver commandDriver, string[] commandArguments) { this.thrownException = null; this.command = commandToExecute; this.driver = commandDriver; this.args = commandArguments; Thread executionThread = new Thread(this.RunCommand); executionThread.Start(); executionThread.Join(this.timeout); if (executionThread.IsAlive) { throw new SeleniumException("Timed out running command"); } if (this.thrownException != null) { throw this.thrownException; } return this.commandResult; }