Example #1
0
    def __init__(self,
                 command_executor='http://127.0.0.1:4444/wd/hub',
                 desired_capabilities=None,
                 browser_profile=None):
        """
        Create a new driver that will issue commands using the wire protocol.

        :Args:
         - command_executor - Either a command.CommandExecutor object or a string that specifies the URL of a remote server to send commands to.
         - desired_capabilities - Dictionary holding predefined values for starting a browser
         - browser_profile - A selenium.webdriver.firefox.firefox_profile.FirefoxProfile object.  Only used if Firefox is requested.
        """
        if desired_capabilities is None:
            raise WebDriverException("Desired Capabilities can't be None")
        if not isinstance(desired_capabilities, dict):
            raise WebDriverException(
                "Desired Capabilities must be a dictionary")
        self.command_executor = command_executor
        if type(self.command_executor) is str or type(
                self.command_executor) is unicode:
            self.command_executor = RemoteConnection(command_executor)
        self.session_id = None
        self.capabilities = {}
        self.error_handler = ErrorHandler()
        self.start_client()
        self.start_session(desired_capabilities, browser_profile)
Example #2
0
    def __init__(self,
                 command_executor='http://127.0.0.1:4444/wd/hub',
                 desired_capabilities=None,
                 browser_profile=None):
        """Create a new driver that will issue commands using the wire protocol.

        Args:
          command_executor - Either a command.CommandExecutor object or a string
              that specifies the URL of a remote server to send commands to.
          desired_capabilities - Dictionary holding predefined values for starting 
              a browser    
          browser_profile: A browser profile directory as a Base64-encoded
              zip file.  Only used if Firefox is requested.
        """
        if desired_capabilities is None:
            raise WebDriverException(" Desired Capabilities can't be None")

        self.command_executor = command_executor
        if type(self.command_executor) is str:
            self.command_executor = RemoteConnection(command_executor)

        self.session_id = None
        self.capabilities = {}
        self.error_handler = ErrorHandler()

        self.start_client()
        self.start_session(desired_capabilities, browser_profile)
Example #3
0
    def __init__(self, command_executor, browser_name, platform, version='',
                 javascript_enabled=True):
        """Create a new driver that will issue commands using the wire protocol.

        Args:
          command_executor - Either a command.CommandExecutor object or a string
              that specifies the URL of a remote server to send commands to.
          browser_name - A string indicating which browser to request a new
              session for from the remote server.  Should be one of
              {mobile safari|firefox|internet explorer|htmlunit|chrome}.
          platform - A string indicating the desired platform to request from
              the remote server. Should be one of
              {WINDOWS|XP|VISTA|MAC|LINUX|UNIX|ANY}.
          version - A string indicating a specific browser version to request,
              or an empty string ot use any available browser. Defaults to the
              empty string.
          javascript_enabled - Whether the requested browser should support
              JavaScript.  Defaults to True.
        """
        self.command_executor = command_executor
        if type(self.command_executor) is str:
            self.command_executor = RemoteConnection(command_executor)

        self.session_id = None
        self.capabilities = {}
        self.error_handler = ErrorHandler()

        self.start_client()
        self.start_session(browser_name=browser_name,
                           platform=platform,
                           version=version,
                           javascript_enabled=javascript_enabled)
Example #4
0
    def __init__(self, server, clientType, tid, version='6.0'):
        #版本不一样,支持的命令是不一样的

        #self.clientRsphandler=RspHandler()  # result 非0全部抛异常
        #self.paramChecker=
        #self.rsp_handler=RspHandler()
        #日志模块
        #self.LOG=

        self._host = server
        self._version = version
        self._clientType = clientType
        self._tid = tid
        self._headers = {
            "version": self._version,
            "tid": self._tid,
            "clientType": self._clientType
        }
        self.command_executor = RemoteConnection(server, self._headers)