示例#1
0
    def __init__(self,
                 remote_address: str,
                 desired_capabilities: dict = None,
                 execution_id: str = None):

        if RemoteDriver.__instance is not None:
            raise Exception("A driver session already exists")

        LoggingHelper.configure_logging()

        self._desired_capabilities = desired_capabilities

        self._mate_client: MateClient = MateClient(execution_id)

        AppiumWebDriver.__init__(
            self,
            command_executor=remote_address,
            desired_capabilities=self._desired_capabilities,
        )

        self._mate_client.update_session_id(self.session_id)

        self.command_executor = CustomAppiumCommandExecutor(
            mate_client=self._mate_client,
            remote_server_addr=remote_address,
        )

        # this ensures that mobile-specific commands are also available for our command executor
        self._addCommands()
        RemoteDriver.__instance = self
示例#2
0
    def __init__(
        self,
        desired_capabilities: dict = None,
        token: str = None,
        project_name: str = None,
        job_name: str = None,
        disable_reports: bool = False,
    ):
        if Remote.__instance is not None:
            raise SdkException("A driver session already exists")

        LoggingHelper.configure_logging()

        self._desired_capabilities = desired_capabilities

        self._token = token if token is not None else ConfigHelper.get_developer_token(
        )

        if disable_reports:
            # Setting the project and job name to empty strings will cause the Agent to not initialize a report
            self._project_name = ""
            self._job_name = ""
        else:
            self._project_name = (project_name if project_name is not None else
                                  ReportHelper.infer_project_name())
            self._job_name = (job_name if job_name is not None else
                              ReportHelper.infer_job_name())

        report_settings = ReportSettings(self._project_name, self._job_name)

        self._agent_client: AgentClient = AgentClient(
            token=self._token,
            capabilities=self._desired_capabilities,
            report_settings=report_settings,
        )
        self._agent_session: AgentSession = self._agent_client.agent_session
        self.w3c = True if self._agent_session.dialect == "W3C" else False

        AppiumWebDriver.__init__(
            self,
            command_executor=self._agent_session.remote_address,
            desired_capabilities=self._desired_capabilities,
        )

        self.command_executor = CustomAppiumCommandExecutor(
            agent_client=self._agent_client,
            remote_server_addr=self._agent_session.remote_address,
        )

        # this ensures that mobile-specific commands are also available for our command executor
        self._addCommands()

        Remote.__instance = self
    def __init__(self, command_executor='http://127.0.0.1:4444/wd/hub',
                 desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False):

        capabilities = {
            'automationName' : 'Android',
            'platformName' : 'Android',
            'deviceName' : '',

            'appPackage' : 'com.opera.browser',
            'androidDeviceSocket' : 'com.opera.browser.devtools',
        }
        if desired_capabilities:
            capabilities.update(desired_capabilities)

        AppiumDriver.__init__(self, command_executor, capabilities, browser_profile, proxy, keep_alive)

        self._desired_caps = capabilities
    def __init__(self,
                 command_executor='http://127.0.0.1:4444/wd/hub',
                 desired_capabilities=None,
                 browser_profile=None,
                 proxy=None,
                 keep_alive=False):

        capabilities = {
            'automationName': 'Android',
            'platformName': 'Android',
            'deviceName': '',
            'appPackage': 'com.opera.browser',
            'androidDeviceSocket': 'com.opera.browser.devtools',
        }
        if desired_capabilities:
            capabilities.update(desired_capabilities)

        AppiumDriver.__init__(self, command_executor, capabilities,
                              browser_profile, proxy, keep_alive)

        self._desired_caps = capabilities
示例#5
0
    def __init__(
        self,
        desired_capabilities: dict = None,
        token: str = None,
        project_name: str = None,
        job_name: str = None,
        disable_reports: bool = False,
    ):
        if Remote.__instance is not None:
            raise SdkException("A driver session already exists")

        LoggingHelper.configure_logging()

        self._desired_capabilities = desired_capabilities

        self._token = token if token is not None else ConfigHelper.get_developer_token(
        )

        if disable_reports:
            # Setting the project and job name to empty strings will cause the Agent to not initialize a report
            self._project_name = ""
            self._job_name = ""
        else:
            self._project_name = (project_name if project_name is not None else
                                  ReportHelper.infer_project_name())

            if job_name:
                self._job_name = job_name
            else:
                self._job_name = ReportHelper.infer_job_name()
                # Can update job name at runtime if not specified.
                os.environ[
                    EnvironmentVariable.TP_UPDATE_JOB_NAME.value] = "True"

        report_settings = ReportSettings(self._project_name, self._job_name)

        self._agent_client: AgentClient = AgentClient(
            token=self._token,
            capabilities=self._desired_capabilities,
            report_settings=report_settings,
        )
        self._agent_session: AgentSession = self._agent_client.agent_session
        self.w3c = True if self._agent_session.dialect == "W3C" else False

        AppiumWebDriver.__init__(
            self,
            command_executor=self._agent_session.remote_address,
            desired_capabilities=self._desired_capabilities,
        )

        self.command_executor = CustomAppiumCommandExecutor(
            agent_client=self._agent_client,
            remote_server_addr=self._agent_session.remote_address,
        )

        # this ensures that mobile-specific commands are also available for our command executor
        self._addCommands()

        # Disable automatic command and test reports if Behave reporting is enabled.
        if os.getenv("TP_DISABLE_AUTO_REPORTING") == "True":
            self.command_executor.disable_command_reports = True
            self.command_executor.disable_auto_test_reports = True

        Remote.__instance = self