Class SimpleCommandDispatcher

  • All Implemented Interfaces:

    
    public final class SimpleCommandDispatcher
    
                        

    Dispatches web driver commands provided in text format.

    This class serves as a bridge between text-based automation commands and WebDriver actions. It parses string commands and executes the corresponding WebDriver methods, enabling script-based control of browser automation.

    Author:

    Vincent Zhang

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Object execute(String command, WebDriver driver) Executes a WebDriver command provided as a text string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleCommandDispatcher

        SimpleCommandDispatcher()
    • Method Detail

      • execute

         final Object execute(String command, WebDriver driver)

        Executes a WebDriver command provided as a text string.

        Parses the command string to extract the function name and arguments, then invokes the corresponding WebDriver method. For example, the string "driver.open('https://example.com')" would be parsed and the driver.open() method would be called with the URL argument.

        Parameters:
        command - The command in text format (e.g., "driver.method(arg1, arg2)").
        driver - The WebDriver instance to execute the command on.
        Returns:

        The result of the command execution, or null if the command could not be executed.