Пример #1
0
    def configure(self, options, conf):
        super(SeleniumBase, self).configure(options, conf)
        if not self.enabled:
            return

        # Determine the browser version to use, and configure settings
        self.browser_settings = {
            "browserName": options.browser,
            'name': self.conf.testNames[0],
            'build': os.getenv('BUILD_TAG'),
            'project': os.getenv('JOB_NAME')
        }

        if options.browser == constants.Browser.INTERNET_EXPLORER:
            self.browser_settings["platform"] = "WINDOWS"
            self.browser_settings["browserName"] = "internet explorer"
        
        if options.browser_version == 'latest':
            version = constants.Browser.LATEST[options.browser]
            if version is not None:
                self.browser_settings["version"] = version
        else:
            version_options = constants.Browser.VERSION[options.browser]
            if (version_options is not None and 
                options.browser_version in version_options):
                self.browser_settings["version"] = options.browser_version

        self.options = options
        ### print 'OPTIONS = ' + str(self.options)  # Try this for debugging if needed

        if (self.options.servername == "localhost" and
            self.options.browser == constants.Browser.HTML_UNIT):
            selenium_launcher.execute_selenium(self.options.servername,
                                               self.options.port,
                                               self.options.log_path)
Пример #2
0
    def configure(self, options, conf):
        super(SeleniumBase, self).configure(options, conf)
        if not self.enabled:
            return

        #determine the browser version to use and create our own 
        #DesiredCapabilities dict
        self.browser_settings = {
            "browserName": options.browser,
            "selenium-version": '2.28.0'
        }
        
        if options.browser_version == 'latest':
            version = constants.Browser.LATEST[options.browser]
            if version is not None:
                self.browser_settings["version"] = version
        else:
            version_options = constants.Browser.VERSION[options.browser]
            if (version_options is not None and 
                options.browser_version in version_options):
                self.browser_settings["version"] = options.browser_version

        # browser-specific capabilities settings:
        # ie
        if options.browser == constants.Browser.INTERNET_EXPLORER:
            if options.browser_version == 'latest' or options.browser_version == '9':
                self.browser_settings["platform"] = "Windows 2008"
            else:
                self.browser_settings["platform"] = "WINDOWS"
            self.browser_settings["browserName"] = "internet explorer"

        # ipad
        if options.browser == constants.Browser.IPAD:
            self.browser_settings["platform"] = 'Mac 10.8'
                
        self.options = options

        # chrome
        #  kind of a hack for sauce 
        if options.browser == constants.Browser.GOOGLE_CHROME:
            self.browser_settings["version"] = ''


        if (self.options.servername == "localhost" and
            self.options.browser == constants.Browser.HTML_UNIT):
            selenium_launcher.execute_selenium(self.options.servername,
                                               self.options.port,
                                               self.options.log_path)
            time.sleep(20)
            try:
                driver = webdriver.Remote("http://%s:%s/wd/hub" %
                                          (self.options.servername,
                                          self.options.port),
                                          DesiredCapabilities.HTML_UNIT)
                driver.quit()
            except:
                raise Exception ("Selenium did not launch. Try again.")
Пример #3
0
    def configure(self, options, conf):
        super(SeleniumBase, self).configure(options, conf)
        if not self.enabled:
            return

        # Determine the browser version to use, and create a DesiredCapabilities dict
        self.browser_settings = {
            "browserName": options.browser,
            'name': self.conf.testNames[0],
            'build': os.getenv('BUILD_TAG'),
            'project': os.getenv('JOB_NAME')
        }

        if options.browser == constants.Browser.INTERNET_EXPLORER:
            self.browser_settings["platform"] = "WINDOWS"
            self.browser_settings["browserName"] = "internet explorer"
        
        if options.browser_version == 'latest':
            version = constants.Browser.LATEST[options.browser]
            if version is not None:
                self.browser_settings["version"] = version
        else:
            version_options = constants.Browser.VERSION[options.browser]
            if (version_options is not None and 
                options.browser_version in version_options):
                self.browser_settings["version"] = options.browser_version

        self.options = options
        ### print 'OPTIONS = ' + str(self.options)  # Try this for debugging if needed

        if (self.options.servername == "localhost" and
            self.options.browser == constants.Browser.HTML_UNIT):
            selenium_launcher.execute_selenium(self.options.servername,
                                               self.options.port,
                                               self.options.log_path)
            time.sleep(20)
            try:
                driver = webdriver.Remote("http://%s:%s/wd/hub" %
                                          (self.options.servername,
                                          self.options.port),
                                          DesiredCapabilities.HTML_UNIT)
                driver.quit()
            except:
                raise Exception ("Selenium did not launch. Try again.")