当前位置: 首页>>代码示例>>Python>>正文


Python firefox_profile.FirefoxProfile类代码示例

本文整理汇总了Python中selenium.webdriver.firefox.firefox_profile.FirefoxProfile的典型用法代码示例。如果您正苦于以下问题:Python FirefoxProfile类的具体用法?Python FirefoxProfile怎么用?Python FirefoxProfile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FirefoxProfile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: disableImages

	def disableImages(self):
		fireFoxProfile = FirefoxProfile()	# Nuovo profilo di FireFox #(anonimo credo, ma non importa, a meno che non voglia crearne uno, salvarlo e caricarlo da qua) 
		
		fireFoxProfile.set_preference('permissions.default.stylesheet', 2)						# no CSS
		fireFoxProfile.set_preference('permissions.default.image', 2)							# no Image
		# fireFoxProfile.set_preference('dom.ipc.plugins.enabled.libflashplayer.so','false')	# no Flash 
		return fireFoxProfile	# restituico il profilo appena creato
开发者ID:Stravanni,项目名称:Gplay-Scraper,代码行数:7,代码来源:__init__.py

示例2: webdriver_class

        def webdriver_class():
            profile = FirefoxProfile()

            # Make sure Firefox WebDriver addon works, even if it could not be verified
            profile.set_preference('xpinstall.signatures.required', False)
            webdriver = Firefox(profile)
            return webdriver
开发者ID:Ins1ne,项目名称:Selenium-Requests,代码行数:7,代码来源:test_seleniumrequests.py

示例3: setup_slow_browser

def setup_slow_browser():
    # Start the browser
    profile = FirefoxProfile()
    # When inserting many lines of text the Javascript process takes ages
    profile.set_preference('dom.max_script_run_time', 10*60)
    profile.set_preference('dom.max_chrome_script_run_time', 10*60)
    world.slow_browser = webdriver.Firefox(firefox_profile=profile)
开发者ID:cburgmer,项目名称:deniz,代码行数:7,代码来源:validate-steps.py

示例4: setup_browser

def setup_browser():
    world.browser = None
    browser = getattr(settings, 'BROWSER', None)
    if browser is None:
        raise Exception('Please configure a browser in settings_test.py')
    elif browser == 'Firefox':
        ff_profile = FirefoxProfile()
        ff_profile.set_preference("webdriver_enable_native_events", False)
        world.browser = webdriver.Firefox(ff_profile)
    elif browser == 'Chrome':
        world.browser = webdriver.Chrome()
    elif browser == "Headless":
        world.browser = webdriver.PhantomJS(
            desired_capabilities={'handlesAlerts': True})

    world.client = client.Client()
    world.using_selenium = False

    world.browser.set_window_position(0, 0)
    world.browser.set_window_size(1024, 768)

    # Wait implicitly for 2 seconds
    world.browser.implicitly_wait(2)

    # stash
    world.memory = {}
开发者ID:6C1,项目名称:mediathread,代码行数:26,代码来源:terrain.py

示例5: setup_browser

def setup_browser():
    world.browser = None
    browser = getattr(settings, 'BROWSER', None)
    if browser is None:
        raise Exception('Please configure a browser in settings_test.py')
    elif browser == 'Firefox':
        ff_profile = FirefoxProfile()
        ff_profile.set_preference("webdriver_enable_native_events", False)
        world.browser = webdriver.Firefox(ff_profile)
    elif browser == 'Chrome':
        world.browser = webdriver.Chrome()
    elif browser == "Headless":
        world.browser = webdriver.PhantomJS(
            desired_capabilities={'handlesAlerts': True})
        cmd = "window.moveTo(0, 1); window.resizeTo(%s, %s);" % (1024, 768)
        world.browser.execute_script(cmd)

    world.client = client.Client()
    world.using_selenium = False

    # Make the browser size at least 1024x768
    world.browser.execute_script("window.moveTo(0, 1); "
                                 "window.resizeTo(1024, 768);")

    # Wait implicitly for 2 seconds
    world.browser.implicitly_wait(5)

    # stash
    world.memory = {}
开发者ID:appsembler,项目名称:mediathread-openshift-quickstart-backup,代码行数:29,代码来源:terrain.py

示例6: setup_browser

def setup_browser():
    firefox_profile = FirefoxProfile()
    # Reduce bandwidth consumption and increase speed by disabling images, Flash
    firefox_profile.set_preference('permissions.default.image', 2)
    firefox_profile.set_preference('dom.ipc.plugins.enabled.libflashplayer.so',
                                  'false')
    return webdriver.Firefox(firefox_profile)
开发者ID:mab13,项目名称:GooglePrivacyEnhancer,代码行数:7,代码来源:script.py

示例7: launch_browser

def launch_browser():

    if env.RUNNING_BROWSER.upper() == "FIREFOX":
        # the end of the browser process , the end of the browser driven process
        os.popen("TASKKILL /F /IM firefoxdriver.exe")

        fp = FirefoxProfile()
        fp.native_events_enabled = False

        binary_path = PublicImp.common.get_value_from_conf("FIREFOX_BINARY_PATH")

        if binary_path == "":
            env.driver = selenium.webdriver.Firefox(firefox_profile=fp)
        else:
            fb = FirefoxBinary(firefox_path=binary_path)
            env.driver = selenium.webdriver.Firefox(firefox_profile=fp, firefox_binary=fb)

    elif env.RUNNING_BROWSER.upper() == "CHROME":
        os.popen("TASKKILL /F /IM chromedriver.exe")

        binary_path = PublicImp.common.get_value_from_conf("CHROME_BINARY_PATH")
        chromedriver = PublicImp.common.get_value_from_conf("DRIVER_CHROME")

        if binary_path == "":
            os.environ["webdriver.chrome.driver"] = chromedriver
            env.driver = selenium.webdriver.Chrome(executable_path=chromedriver)
        else:
            opts = Options()
            opts.binary_location = binary_path
            os.environ["webdriver.chrome.driver"] = chromedriver
            env.driver = selenium.webdriver.Chrome(executable_path=chromedriver, chrome_options=opts)

    elif env.RUNNING_BROWSER.upper() == "IE":
        os.popen("TASKKILL /F /IM IEDriverServer.exe")

        dc = DesiredCapabilities.INTERNETEXPLORER.copy()

        dc['acceptSslCerts'] = True
        dc['nativeEvents'] = True

        iedriver = PublicImp.common.get_value_from_conf("DRIVER_IE")
        os.environ["webdriver.ie.driver"] = iedriver
        env.driver = selenium.webdriver.Ie(executable_path=iedriver, capabilities=dc)

    else:
        return False

    env.platformName = env.RUNNING_BROWSER

    env.TEST_URL = PublicImp.common.get_value_from_conf("TESTING_URL")
    env.driver.get(env.TEST_URL)
    env.driver.maximize_window()

    time.sleep(3)
    env.driver.refresh()
    # env.driver.set_window_size(480, 800)
    time.sleep(3)

    return True
开发者ID:yzwy1988,项目名称:YOHO_Automated_Test,代码行数:59,代码来源:executer.py

示例8: setUp

 def setUp(self):
     ''' set up test '''
     os.environ["DISPLAY"] = ":99"
     ffx_bin = FirefoxBinary("/usr/bin/firefox")
     ffx_profile = FirefoxProfile()
     ffx_profile.accept_untrusted_certs = True
     self.driver = webdriver.Firefox(firefox_binary=ffx_bin,
                                     firefox_profile=ffx_profile)
开发者ID:mcjug2015,项目名称:django_template,代码行数:8,代码来源:base_tests.py

示例9: get_driver

    def get_driver(self):
        from selenium.webdriver import Firefox as FirefoxWebDriver
        from selenium.webdriver import Chrome as ChromeDriver
        from selenium.webdriver import Remote as RemoteDriver

        # Lazilly gets the driver one time cant call in begin since ssh tunnel
        # may not be created
        if self._driver:
            return self._driver

        if self._driver_type == 'firefox':
            from selenium.webdriver.firefox.firefox_profile import FirefoxProfile  # noqa
            fp = FirefoxProfile()

            for override in self._ff_profile_overrides:
                pref, value = override.split('=')
                fp.set_preference(pref, literal_eval(value))

            self._profile = fp

            if self._firefox_binary is None:
                self._driver = FirefoxWebDriver(firefox_profile=self._profile)
            else:
                from selenium.webdriver.firefox.firefox_binary import FirefoxBinary  # noqa
                binary = FirefoxBinary(self._firefox_binary)
                self._driver = FirefoxWebDriver(
                    firefox_profile=self._profile,
                    firefox_binary=binary
                )
        elif self._driver_type == 'chrome':
            self._driver = ChromeDriver()
        else:
            timeout = 60
            step = 1
            current = 0
            while current < timeout:
                try:
                    self._driver = RemoteDriver(
                        'http://%s:%s/wd/hub' % (
                            self._remote_server_address,
                            self._selenium_port,
                        ),
                        self._driver_type,
                        'WINDOWS',
                    )
                    break
                except URLError:
                    time.sleep(step)
                    current += step
                except BadStatusLine:
                    self._driver = None
                    break
            if current >= timeout:
                raise URLError('timeout')

        monkey_patch_methods(self._driver)
        return self._driver
开发者ID:nosedjango,项目名称:nosedjango,代码行数:57,代码来源:selenium_plugin.py

示例10: setUpClass

    def setUpClass(cls):
        from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
        profile = FirefoxProfile()
        profile.set_preference('geo.prompt.testing', True)
        profile.set_preference('geo.prompt.testing.allow', True)
        cls.browser = webdriver.Firefox(profile)

        cls.browser.implicitly_wait(10)
        super(RegistrationTests, cls).setUpClass()
开发者ID:Munk801,项目名称:book3-exercises,代码行数:9,代码来源:testPage.py

示例11: setup_browser

def setup_browser():
    ff_profile = FirefoxProfile()
    ff_profile.set_preference("webdriver_enable_native_events", False)
    world.firefox = webdriver.Firefox(ff_profile)
    world.client = client.Client()
    world.using_selenium = False

    # Make the browser size at least 1024x768
    world.firefox.execute_script("window.moveTo(0, 1); window.resizeTo(1024, 768);")
开发者ID:tomaszzielinski,项目名称:mediathread,代码行数:9,代码来源:terrain.py

示例12: testCopyFromSource

 def testCopyFromSource(self):
     dir_name = tempfile.mkdtemp()
     self._create_dummy_file(dir_name)
     profile = FirefoxProfile()
     profile.copy_profile_source(dir_name)
     profile_dir = profile.path
     dst_pref_file = open(os.path.join(profile_dir, self.DUMMY_FILE_NAME))
     content = dst_pref_file.read()
     self.assertEquals(self.DUMMY_FILE_CONTENT, content)
开发者ID:Escobita,项目名称:selenium,代码行数:9,代码来源:profile_tests.py

示例13: setup_browser

def setup_browser(variables):
    world.using_selenium = False
    if skip_selenium():
        world.browser = None
        world.skipping = False
    else:
        ff_profile = FirefoxProfile()
        ff_profile.set_preference("webdriver_enable_native_events", False)
        world.firefox = webdriver.Firefox(ff_profile)
        world.using_selenium = False
    world.client = client.Client()
开发者ID:nikolas,项目名称:plexus,代码行数:11,代码来源:terrain.py

示例14: disableImages

def disableImages(self):
    ## get the Firefox profile object
    firefoxProfile = FirefoxProfile()
    ## Disable CSS
    #firefoxProfile.set_preference('permissions.default.stylesheet', 2)
    ## Disable images
    firefoxProfile.set_preference('permissions.default.image', 2)
    ## Disable Flash
    firefoxProfile.set_preference('dom.ipc.plugins.enabled.libflashplayer.so',
                                  'false')
    ## Set the modified profile while creating the browser object 
    self.browserHandle = webdriver.Firefox(firefoxProfile)
开发者ID:jzhang0228,项目名称:coin_registeration,代码行数:12,代码来源:tmp.py

示例15: __init__

 def __init__(self):
     firefox_profile = FirefoxProfile()
     # we need to turn off stylesheets because otherwise Selenium couldn't find
     # the the buttons in tests
     firefox_profile.set_preference('permissions.default.stylesheet', 2)
     super(WebDriver, self).__init__(
             command_executor='http://127.0.0.1:4444/wd/hub',
             browser_profile=firefox_profile,
             desired_capabilities=DesiredCapabilities.FIREFOX)
     self.set_page_load_timeout(60)
     self.implicitly_wait(60)
     self.base_url = "http://oioioi:8000"
     self.delete_all_cookies()
开发者ID:sio2project,项目名称:oioioi,代码行数:13,代码来源:__init__.py


注:本文中的selenium.webdriver.firefox.firefox_profile.FirefoxProfile类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。