Python selenium.webdriver.common.desired_capabilities.DesiredCapabilities 模块,OPERA 实例源码

我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用selenium.webdriver.common.desired_capabilities.DesiredCapabilities.OPERA

项目:devsecops-example-helloworld    作者:boozallen    | 项目源码 | 文件源码
def to_capabilities(self):
        """
            Creates a capabilities with all the options that have been set and

            returns a dictionary with everything
        """
        capabilities = ChromeOptions.to_capabilities(self)
        capabilities.update(DesiredCapabilities.OPERA)
        opera_options = capabilities["operaOptions"] = \
            capabilities.pop("chromeOptions")

        if self.android_package_name:
            opera_options["androidPackage"] = self.android_package_name
        if self.android_device_socket:
            opera_options["androidDeviceSocket"] = self.android_device_socket
        if self.android_command_line_file:
            opera_options["androidCommandLineFile"] = \
                self.android_command_line_file
        return capabilities
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def to_capabilities(self):
        """
            Creates a capabilities with all the options that have been set and

            returns a dictionary with everything
        """
        capabilities = ChromeOptions.to_capabilities(self)
        capabilities.update(DesiredCapabilities.OPERA)
        opera_options = capabilities["operaOptions"] = \
            capabilities.pop("chromeOptions")

        if self.android_package_name:
            opera_options["androidPackage"] = self.android_package_name
        if self.android_device_socket:
            opera_options["androidDeviceSocket"] = self.android_device_socket
        if self.android_command_line_file:
            opera_options["androidCommandLineFile"] = \
                self.android_command_line_file
        return capabilities
项目:leetcode    作者:thomasyimgit    | 项目源码 | 文件源码
def to_capabilities(self):
        """
            Creates a capabilities with all the options that have been set and

            returns a dictionary with everything
        """
        capabilities = ChromeOptions.to_capabilities(self)
        capabilities.update(DesiredCapabilities.OPERA)
        opera_options = capabilities["operaOptions"] = \
            capabilities.pop("chromeOptions")

        if self.android_package_name:
            opera_options["androidPackage"] = self.android_package_name
        if self.android_device_socket:
            opera_options["androidDeviceSocket"] = self.android_device_socket
        if self.android_command_line_file:
            opera_options["androidCommandLineFile"] = \
                self.android_command_line_file
        return capabilities
项目:ShuoshuoMonitor    作者:aploium    | 项目源码 | 文件源码
def to_capabilities(self):
        """
            Creates a capabilities with all the options that have been set and

            returns a dictionary with everything
        """
        capabilities = ChromeOptions.to_capabilities(self)
        capabilities.update(DesiredCapabilities.OPERA)
        opera_options = capabilities["operaOptions"] = \
            capabilities.pop("chromeOptions")

        if self.android_package_name:
            opera_options["androidPackage"] = self.android_package_name
        if self.android_device_socket:
            opera_options["androidDeviceSocket"] = self.android_device_socket
        if self.android_command_line_file:
            opera_options["androidCommandLineFile"] = \
                self.android_command_line_file
        return capabilities
项目:amazon_order_history_scraper    作者:drewctate    | 项目源码 | 文件源码
def to_capabilities(self):
        """
            Creates a capabilities with all the options that have been set and

            returns a dictionary with everything
        """
        capabilities = ChromeOptions.to_capabilities(self)
        capabilities.update(DesiredCapabilities.OPERA)
        opera_options = capabilities["operaOptions"] = \
            capabilities.pop("chromeOptions")

        if self.android_package_name:
            opera_options["androidPackage"] = self.android_package_name
        if self.android_device_socket:
            opera_options["androidDeviceSocket"] = self.android_device_socket
        if self.android_command_line_file:
            opera_options["androidCommandLineFile"] = \
                self.android_command_line_file
        return capabilities
项目:webapp    作者:superchilli    | 项目源码 | 文件源码
def to_capabilities(self):
        """
            Creates a capabilities with all the options that have been set and

            returns a dictionary with everything
        """
        capabilities = ChromeOptions.to_capabilities(self)
        capabilities.update(DesiredCapabilities.OPERA)
        opera_options = capabilities["operaOptions"] = \
            capabilities.pop("chromeOptions")

        if self.android_package_name:
            opera_options["androidPackage"] = self.android_package_name
        if self.android_device_socket:
            opera_options["androidDeviceSocket"] = self.android_device_socket
        if self.android_command_line_file:
            opera_options["androidCommandLineFile"] = \
                self.android_command_line_file
        return capabilities
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def __init__(self, executable_path=None, port=0,
                 desired_capabilities=DesiredCapabilities.OPERA):
        """
        Creates a new instance of the Opera driver.

        Starts the service and then creates new instance of Opera Driver.

        :Args:
         - executable_path - path to the executable. If the default is used
                             it assumes the executable is in the
                             Environment Variable SELENIUM_SERVER_JAR
         - port - port you would like the service to run, if left as 0,
                  a free port will be found.
         - desired_capabilities: Dictionary object with desired capabilities -
                                 may be used to provide various Opera switches.
        """
        if executable_path is None:
            try:
                executable_path = os.environ["SELENIUM_SERVER_JAR"]
            except:
                raise Exception("No executable path given, please add one \
                      to Environment Variable 'SELENIUM_SERVER_JAR'")
        self.service = Service(executable_path, port=port)
        self.service.start()

        RemoteWebDriver.__init__(self,
                                 command_executor=self.service.service_url,
                                 desired_capabilities=desired_capabilities)
        self._is_remote = False
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def __init__(self,
                 desired_capabilities=None,
                 executable_path=None,
                 port=0,
                 service_log_path=None,
                 service_args=None,
                 opera_options=None):
        engine = (desired_capabilities.get('engine', None)
                  if desired_capabilities else None)
        if (engine == WebDriver.ServiceType.CHROMIUM or
                opera_options and opera_options.android_package_name):
            OperaDriver.__init__(self, executable_path=executable_path,
                                 port=port, opera_options=opera_options,
                                 service_args=service_args,
                                 desired_capabilities=desired_capabilities,
                                 service_log_path=service_log_path)
        else:
            if service_log_path:
                print("Warning! service_log_path shouldn't be used " +
                      "with Presto based Opera")
            if service_args:
                print("Warning! service_args shouldn't be used with " +
                      "Presto based Opera")
            if opera_options:
                print("Warning! opera_options shouldn't be used with " +
                      "Presto based Opera")
            if not desired_capabilities:
                desired_capabilities = DesiredCapabilities.OPERA
            PrestoDriver.__init__(self, executable_path=executable_path,
                                  port=port,
                                  desired_capabilities=desired_capabilities)
项目:TestRewrite    作者:osqa-interns    | 项目源码 | 文件源码
def start_opera(self, location):
        """Opera initiator."""
        webdriver_service = service.Service(location)
        webdriver_service.start()
        return webdriver.Remote(
            webdriver_service.service_url,
            DesiredCapabilities.OPERA.copy()
        )
项目:webapp    作者:superchilli    | 项目源码 | 文件源码
def __init__(self, executable_path=None, port=0,
                 desired_capabilities=DesiredCapabilities.OPERA):
        """
        Creates a new instance of the Opera driver.

        Starts the service and then creates new instance of Opera Driver.

        :Args:
         - executable_path - path to the executable. If the default is used
                             it assumes the executable is in the
                             Environment Variable SELENIUM_SERVER_JAR
         - port - port you would like the service to run, if left as 0,
                  a free port will be found.
         - desired_capabilities: Dictionary object with desired capabilities -
                                 may be used to provide various Opera switches.
        """
        if executable_path is None:
            try:
                executable_path = os.environ["SELENIUM_SERVER_JAR"]
            except:
                raise Exception("No executable path given, please add one \
                      to Environment Variable 'SELENIUM_SERVER_JAR'")
        self.service = Service(executable_path, port=port)
        self.service.start()

        RemoteWebDriver.__init__(self,
                                 command_executor=self.service.service_url,
                                 desired_capabilities=desired_capabilities)
        self._is_remote = False
项目:webapp    作者:superchilli    | 项目源码 | 文件源码
def __init__(self,
                 desired_capabilities=None,
                 executable_path=None,
                 port=0,
                 service_log_path=None,
                 service_args=None,
                 opera_options=None):
        engine = (desired_capabilities.get('engine', None)
                  if desired_capabilities else None)
        if (engine == WebDriver.ServiceType.CHROMIUM or
                opera_options and opera_options.android_package_name):
            OperaDriver.__init__(self, executable_path=executable_path,
                                 port=port, opera_options=opera_options,
                                 service_args=service_args,
                                 desired_capabilities=desired_capabilities,
                                 service_log_path=service_log_path)
        else:
            if service_log_path:
                print("Warning! service_log_path shouldn't be used " +
                      "with Presto based Opera")
            if service_args:
                print("Warning! service_args shouldn't be used with " +
                      "Presto based Opera")
            if opera_options:
                print("Warning! opera_options shouldn't be used with " +
                      "Presto based Opera")
            if not desired_capabilities:
                desired_capabilities = DesiredCapabilities.OPERA
            PrestoDriver.__init__(self, executable_path=executable_path,
                                  port=port,
                                  desired_capabilities=desired_capabilities)
项目:test-automation    作者:openstax    | 项目源码 | 文件源码
def start_opera(self, location):
        """Opera initiator."""
        webdriver_service = service.Service(location)
        webdriver_service.start()
        return webdriver.Remote(
            webdriver_service.service_url,
            DesiredCapabilities.OPERA.copy()
        )