Python selenium.webdriver.FirefoxProfile() Examples

The following are 30 code examples of selenium.webdriver.FirefoxProfile(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module selenium.webdriver , or try the search function .
Example #1
Source File: make.py    From facebook-friends-map with MIT License 13 votes vote down vote up
def start_browser():
    # Ensure mobile-friendly view for parsing
    useragent = "Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Mobile Safari/537.36"

    #Firefox
    profile = webdriver.FirefoxProfile()
    profile.set_preference("general.useragent.override", useragent)
    options = webdriver.FirefoxOptions()
    options.set_preference("dom.webnotifications.serviceworker.enabled", False)
    options.set_preference("dom.webnotifications.enabled", False)
    options.add_argument('--headless')

    browser = webdriver.Firefox(firefox_profile=profile,options=options)
    return browser

# Login 
Example #2
Source File: test_get_proxy.py    From wanggeService with MIT License 10 votes vote down vote up
def test_webdriver2(self):
        import time
        from selenium import webdriver

        # myProxy = "127.0.0.1:9150"
        myProxy = "192.168.103.1:1081"
        ip, port = myProxy.split(":")
        fp = webdriver.FirefoxProfile()
        fp.set_preference('network.proxy.type', 1)
        fp.set_preference('network.proxy.socks', ip)
        fp.set_preference('network.proxy.socks_port', int(port))
        driver = webdriver.Firefox(fp)
        url = 'https://api.ipify.org'
        # url = "http://data.eastmoney.com/hsgtcg/StockHdDetail.aspx?stock=600519&date=2018-06-12/"
        driver.get(url)
        # print(driver.find_element_by_tag_name('table').text)
        print(driver.find_element_by_tag_name('pre').text)
        driver.get('https://check.torproject.org/')
        time.sleep(3)
        driver.quit() 
Example #3
Source File: test_examples.py    From python-anticaptcha with MIT License 10 votes vote down vote up
def test_process(self):
        from examples import recaptcha_selenium
        from selenium.webdriver import Firefox
        from selenium.webdriver.firefox.options import Options
        from selenium.webdriver import FirefoxProfile

        options = Options()
        options.add_argument("-headless")

        ffprofile = FirefoxProfile()
        ffprofile.set_preference("intl.accept_languages", "en-US")

        driver = Firefox(firefox_profile=ffprofile, firefox_options=options)
        self.assertIn(
            recaptcha_selenium.EXPECTED_RESULT, recaptcha_selenium.process(driver)
        )
        driver.quit() 
Example #4
Source File: harvest_utils.py    From DLink_Harvester with GNU General Public License v3.0 6 votes vote down vote up
def getFirefox(tempDir='/tmp', showImage=1):
    """get Firefox Webdriver object
    :param showImage: 2 = don't show, 1=show
    """
    proxy = Proxy(dict(proxyType=ProxyType.AUTODETECT))
    profile = webdriver.FirefoxProfile()
    profile.set_preference("plugin.state.flash", 0)
    profile.set_preference("plugin.state.java", 0)
    profile.set_preference("media.autoplay.enabled", False)
    # 2=dont_show, 1=normal
    profile.set_preference("permissions.default.image", showImage)
    profile.set_preference("webdriver.load.strategy", "unstable")
    # automatic download
    # 2 indicates a custom (see: browser.download.dir) folder.
    profile.set_preference("browser.download.folderList", 2)
    # whether or not to show the Downloads window when a download begins.
    profile.set_preference("browser.download.manager.showWhenStarting", False)
    profile.set_preference("browser.download.dir", tempDir)
    profile.set_preference("browser.helperApps.neverAsk.saveToDisk",
                           "application/octet-stream"+
                           ",application/zip"+
                           ",application/x-rar-compressed"+
                           ",application/x-gzip"+
                           ",application/msword")
    return webdriver.Firefox(firefox_profile=profile, proxy=proxy) 
Example #5
Source File: Robot.py    From AmazonRobot with MIT License 6 votes vote down vote up
def __init__(self, proxy):
        """init the webdriver by setting the proxy and user-agent
        
        Args:
            proxy (str): proxy in the form of ip:port
        """
        # set proxy
        ip, port = proxy.split(':')
        profile = webdriver.FirefoxProfile()
        profile.set_preference("network.proxy.type", 1)
        profile.set_preference("network.proxy.http", ip)
        profile.set_preference("network.proxy.http_port", port)
        # set user_agent
        profile.set_preference("general.useragent.override", generate_user_agent())

        profile.update_preferences()
        self.driver = webdriver.Firefox(firefox_profile=profile)
        
        print 'current proxy: %s'%proxy 
Example #6
Source File: amazon_bot.py    From youtube_tutorials with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, items):
        """Setup bot for Amazon URL."""
        self.amazon_url = "https://www.amazon.ca/"
        self.items = items

        self.profile = webdriver.FirefoxProfile()
        self.options = Options()
        #self.options.add_argument("--headless")
        self.driver = webdriver.Firefox(firefox_profile=self.profile,
                                        firefox_options=self.options)

        # Navigate to the Amazon URL.
        self.driver.get(self.amazon_url)

        # Obtain the source
        self.html = self.driver.page_source
        self.soup = BeautifulSoup(self.html, 'html.parser')
        self.html = self.soup.prettify('utf-8') 
Example #7
Source File: config.py    From EagleEye with Do What The F*ck You Want To Public License 6 votes vote down vote up
def getWebDriver():
    if not os.path.isfile(cfg['WEBDRIVER']['PATH']):
        print("{0} does not exist - install a webdriver".format(cfg['WEBDRIVER']['PATH']))
        sys.exit(-2)
    d = cfg['WEBDRIVER']['ENGINE']
    if d.lower() == 'firefox':
        os.environ["webdriver.firefox.driver"] = cfg['WEBDRIVER']['PATH']
        p = os.path.join(tempfile.gettempdir(), 'imageraider')
        if not os.path.isdir(p):
            os.makedirs(p)
        profile = webdriver.FirefoxProfile()
        profile.set_preference('browser.download.folderList', 2) # custom location
        profile.set_preference('browser.download.manager.showWhenStarting', False)
        profile.set_preference('browser.download.dir', p)
        profile.set_preference('browser.helperApps.neverAsk.saveToDisk', 'text/csv')
        profile.set_preference("browser.link.open_newwindow", 3)
        profile.set_preference("browser.link.open_newwindow.restriction", 2)
        return webdriver.Firefox(profile)
    else:
        os.environ["webdriver.chrome.driver"] = cfg['WEBDRIVER']['PATH']
        return webdriver.Chrome() 
Example #8
Source File: accounts.py    From twitter-accounts-creator-bot with MIT License 6 votes vote down vote up
def getWebdriver(self, driverType):
		if driverType == 'proxy':
			profile = webdriver.FirefoxProfile()
			profile.set_preference( "network.proxy.type", 1 )
			profile.set_preference( "network.proxy.socks", "127.0.0.1" )
			profile.set_preference( "network.proxy.socks_port", 9150 )
			profile.set_preference( "network.proxy.socks_remote_dns", True )
			profile.set_preference( "places.history.enabled", False )
			profile.set_preference( "privacy.clearOnShutdown.offlineApps", True )
			profile.set_preference( "privacy.clearOnShutdown.passwords", True )
			profile.set_preference( "privacy.clearOnShutdown.siteSettings", True )
			profile.set_preference( "privacy.sanitize.sanitizeOnShutdown", True )
			profile.set_preference( "signon.rememberSignons", False )
			profile.set_preference( "network.cookie.lifetimePolicy", 2 )
			profile.set_preference( "network.dns.disablePrefetch", True )
			profile.set_preference( "network.http.sendRefererHeader", 0 )
			profile.set_preference( "javascript.enabled", False )
			profile.set_preference( "permissions.default.image", 2 )
			return webdriver.Firefox(profile)
		elif driverType == 'headless':
			return webdriver.PhantomJS()
		else:
			return webdriver.Firefox() 
Example #9
Source File: launcher.py    From kibitzr with MIT License 6 votes vote down vote up
def firefox(headless=True):
    """
    Context manager returning Selenium webdriver.
    Instance is reused and must be cleaned up on exit.
    """
    from selenium import webdriver
    from selenium.webdriver.firefox.options import Options
    if headless:
        driver_key = 'headless'
        firefox_options = Options()
        firefox_options.add_argument('-headless')
    else:
        driver_key = 'headed'
        firefox_options = None
    # Load profile, if it exists:
    if os.path.isdir(PROFILE_DIR):
        firefox_profile = webdriver.FirefoxProfile(PROFILE_DIR)
    else:
        firefox_profile = None
    if FIREFOX_INSTANCE[driver_key] is None:
        FIREFOX_INSTANCE[driver_key] = webdriver.Firefox(
            firefox_profile=firefox_profile,
            firefox_options=firefox_options,
        )
    yield FIREFOX_INSTANCE[driver_key] 
Example #10
Source File: browser_mgmt.py    From warriorframework with Apache License 2.0 6 votes vote down vote up
def set_firefox_proxy(self, profile_dir, proxy_ip, proxy_port):
        """method to update the given preferences in Firefox profile"""
        # Create a default Firefox profile first and update proxy_ip and port
        ff_profile = webdriver.FirefoxProfile(profile_dir)
        proxy_port = int(proxy_port)
        ff_profile.set_preference("network.proxy.type", 1)
        ff_profile.set_preference("network.proxy.http", proxy_ip)
        ff_profile.set_preference("network.proxy.http_port", proxy_port)
        ff_profile.set_preference("network.proxy.ssl", proxy_ip)
        ff_profile.set_preference("network.proxy.ssl_port", proxy_port)
        ff_profile.set_preference("network.proxy.ftp", proxy_ip)
        ff_profile.set_preference("network.proxy.ftp_port", proxy_port)
        ff_profile.update_preferences()

        return ff_profile

    # private methods 
Example #11
Source File: common.py    From boardfarm with BSD 3-Clause Clear License 6 votes vote down vote up
def firefox_webproxy_driver(ipport):
    '''
    Use this if you started web proxy on a machine connected to router's LAN.
    '''
    proxy = Proxy({
            'proxyType': 'MANUAL',
            'httpProxy': ipport,
            'ftpProxy': ipport,
            'sslProxy': ipport,
            'noProxy': ''
            })
    print("Attempting to open firefox via proxy %s" % ipport)
    profile = webdriver.FirefoxProfile()
    profile.set_preference('network.http.phishy-userpass-length', 255)
    driver = webdriver.Firefox(proxy=proxy, firefox_profile=profile)
    caps = webdriver.DesiredCapabilities.FIREFOX
    proxy.add_to_capabilities(caps)
    #driver = webdriver.Remote(desired_capabilities=caps)
    driver.implicitly_wait(30)
    driver.set_page_load_timeout(30)
    return driver 
Example #12
Source File: browser.py    From QRLJacking with GNU General Public License v3.0 6 votes vote down vote up
def load_cookie(self, session_id):
        sessions = json.load(open( self.sessions_file ))
        cookie_path = sessions[str(session_id)]["session_path"]
        url = sessions[str(session_id)]["web_url"]
        # Setting useragent to the same one the session saved with
        useragent = sessions[str(session_id)]["useragent"]
        profile = FirefoxProfile()
        profile.set_preference("general.useragent.override", useragent )
        cookies = pickle.load(open(cookie_path, "rb"))
        try:
            browser = Firefox(profile)
        except:
            error("Couldn't open browser to view session!")
            return
        browser.get(url)
        browser.delete_all_cookies()
        browser.execute_script("window.localStorage.clear()") # clear the current localStorage
        for cookie in cookies:
            browser.add_cookie(cookie)
        status(f"Session {session_id} loaded")
        browser.refresh()
        self.browsers.append(browser) 
Example #13
Source File: instaRaider.py    From InstaRaider with MIT License 5 votes vote down vote up
def setup_webdriver(self):
        self.profile = webdriver.FirefoxProfile()
        self.profile.set_preference("general.useragent.override", self.user_agent)
        self.webdriver = webdriver.Firefox(self.profile)
        self.webdriver.set_window_size(480, 320)
        self.webdriver.set_window_position(800, 0) 
Example #14
Source File: vkontaktephisher.py    From social_attacker with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self,showbrowser):
		display = Display(visible=0, size=(1600, 1024))
		display.start()
		if not showbrowser:
			os.environ['MOZ_HEADLESS'] = '1'
		firefoxprofile = webdriver.FirefoxProfile()
		firefoxprofile.set_preference("permissions.default.desktop-notification", 1)
		firefoxprofile.set_preference("dom.webnotifications.enabled", 1)
		firefoxprofile.set_preference("dom.push.enabled", 1)
		self.driver = webdriver.Firefox(firefox_profile=firefoxprofile)
		self.driver.implicitly_wait(15)
		self.driver.delete_all_cookies() 
Example #15
Source File: testutils.py    From gigantum-client with MIT License 5 votes vote down vote up
def load_firefox_driver():
    """ Return Firefox webdriver """
    firefox_profile = webdriver.FirefoxProfile()
    firefox_profile.set_preference("browser.privatebrowsing.autostart", True)

    return webdriver.Firefox(firefox_profile=firefox_profile) 
Example #16
Source File: __init__.py    From ontask_b with MIT License 5 votes vote down vote up
def setUpClass(cls):
        super().setUpClass()
        options = Options()
        options.headless = cls.headless
        fp = webdriver.FirefoxProfile()
        fp.set_preference('dom.file.createInChild', True)
        fp.set_preference('font.size.variable.x-western', 14)
        cls.selenium = webdriver.Firefox(options=options, firefox_profile=fp)
        # cls.selenium = webdriver.Chrome()

        # Detect the type of screen being used
        cls.device_pixel_ratio = cls.selenium.execute_script(
            'return window.devicePixelRatio'
        )
        # print('Device Pixel Ratio: {0}'.format(cls.device_pixel_ratio))
        # print('Viewport width: {0}'.format(cls.viewport_width))
        # print('viewport height: {0}'.format(cls.viewport_height))

        cls.selenium.set_window_size(
            cls.viewport_width * cls.device_pixel_ratio,
            cls.viewport_height * cls.device_pixel_ratio)

        # After setting the window size, we need to update these values
        cls.viewport_height = cls.selenium.execute_script(
            'return window.innerHeight'
        )
        cls.viewport_width = cls.selenium.execute_script(
            'return window.innerWidth'
        )
        # cls.selenium.implicitly_wait(30) 
Example #17
Source File: debbit.py    From debbit with MIT License 5 votes vote down vote up
def get_webdriver(merchant):
    WEB_DRIVER_LOCK.acquire()  # Only execute one purchase at a time so the console log messages don't inter mix
    options = Options()
    options.headless = CONFIG['hide_web_browser']
    profile = webdriver.FirefoxProfile(absolute_path('program_files', 'selenium-cookies-extension', 'firefox-profile'))

    # Prevent websites from detecting Selenium via evaluating `if (window.navigator.webdriver == true)` with JavaScript
    profile.set_preference("dom.webdriver.enabled", False)
    profile.set_preference('useAutomationExtension', False)

    try:
        driver = webdriver.Firefox(options=options,
                                 service_log_path=os.devnull,
                                 executable_path=absolute_path('program_files', 'geckodriver'),
                                 firefox_profile=profile)

    except SessionNotCreatedException:
        LOGGER.error('')
        LOGGER.error('Firefox not found. Please install the latest version of Firefox and try again.')
        WEB_DRIVER_LOCK.release()
        sys.exit(1)

    if merchant.use_cookies:
        restore_cookies(driver, merchant.id)

    return driver 
Example #18
Source File: conftest.py    From product-database with MIT License 5 votes vote down vote up
def browser(request):
    """
    initialize the selenium test case
    """
    global driver

    profile = FirefoxProfile()
    profile.accept_untrusted_certs = True
    profile.set_preference("browser.download.folderList", 2)
    profile.set_preference("browser.download.manager.showWhenStarting", False)
    profile.set_preference("browser.download.dir", DOWNLOAD_DIR)
    profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "text/csv")

    capabilities = DesiredCapabilities.FIREFOX.copy()
    capabilities["acceptInsecureCerts"] = True

    driver = Firefox(firefox_profile=profile, capabilities=capabilities,
                     executable_path=os.getenv("FIREFOX_DRIVER_EXEC_PATH", "/usr/local/bin/geckodriver"))

    driver.implicitly_wait(10)
    driver.maximize_window()
    request.addfinalizer(lambda *args: driver.quit())

    yield driver

    time.sleep(5) 
Example #19
Source File: Autoticket.py    From Autoticket with MIT License 5 votes vote down vote up
def login(self):
        if not exists('cookies.pkl'):  # 如果不存在cookie.pkl,就获取一下
            if self.browser == 0: # 选择了Chrome浏览器
                self.driver = webdriver.Chrome()
            elif self.browser == 1: # 选择了Firefox浏览器
                self.driver = webdriver.Firefox()
            else:
                raise Exception("***错误:未知的浏览器类别***")
            self.get_cookie()
            self.driver.quit()
        print('###打开浏览器,进入大麦网###')
        if self.browser == 0: # 选择了Chrome浏览器,并成功加载cookie,设置不载入图片,提高刷新效率
            options = webdriver.ChromeOptions()
            prefs = {"profile.managed_default_content_settings.images":2}
            options.add_experimental_option("prefs",prefs)
            self.driver = webdriver.Chrome(options=options)
        elif self.browser == 1: # 选择了火狐浏览器
            options = webdriver.FirefoxProfile()
            options.set_preference('permissions.default.image', 2)  
            self.driver = webdriver.Firefox(options)
        else: 
            raise Exception("***错误:未知的浏览器类别***")
        self.driver.get(self.target_url)
        self.set_cookie()
        # self.driver.maximize_window()
        self.driver.refresh() 
Example #20
Source File: yahoo_csv_download.py    From stock_and_python_book with MIT License 5 votes vote down vote up
def download_stock_csv(code_range, save_dir):

    # CSVファイルを自動で save_dir に保存するための設定
    profile = webdriver.FirefoxProfile()
    profile.set_preference("browser.download.folderList",
                           2)
    profile.set_preference("browser.download.manager.showWhenStarting",
                           False)
    profile.set_preference("browser.download.dir", save_dir)
    profile.set_preference("browser.helperApps.neverAsk.saveToDisk",
                           "text/csv")

    driver = webdriver.Firefox(firefox_profile=profile)
    driver.get('https://www.yahoo.co.jp/')

    # ここで手動でログインを行う。ログインしたら enter
    input('After login, press enter: ')

    for code in code_range:
        url = 'https://stocks.finance.yahoo.co.jp/stocks/history/?code={0}.T'.format(code)
        driver.get(url)

        try:
            driver.find_element_by_css_selector('a.stocksCsvBtn').click()
        except NoSuchElementException:
            pass 
Example #21
Source File: plugin.py    From robotframework-seleniumtestability with Apache License 2.0 5 votes vote down vote up
def generate_firefox_profile(
        self: "SeleniumTestability",
        preferences: OptionalDictType = None,
        accept_untrusted_certs: bool = False,
        proxy: OptionalStrType = None,
    ) -> FirefoxProfile:
        """
        Generates a firefox profile that sets up few required preferences for SeleniumTestability to support all necessary features.
        Parameters:
        - ``preferences`` - firefox profile preferences in dictionary format.
        - ``accept_untrusted_certs`` should we accept untrusted/self-signed certificates.
        - ``proxy`` proxy options

        Note: If you opt out using this keyword, you are not able to get logs with ``Get Logs`` and Firefox.
        """
        profile = FirefoxProfile()
        if preferences:
            for key, value in preferences.items():  # type: ignore
                profile.set_preference(key, value)

        profile.set_preference("devtools.console.stdout.content", True)

        profile.accept_untrusted_certs = accept_untrusted_certs

        if proxy:
            profile.set_proxy(proxy)

        profile.update_preferences()
        return profile 
Example #22
Source File: headless_browser.py    From centinel with MIT License 5 votes vote down vote up
def setup_profile(self, firebug=True, netexport=True):
        """
        Setup the profile for firefox
        :param firebug: whether add firebug extension
        :param netexport: whether add netexport extension
        :return: a firefox profile object
        """
        profile = webdriver.FirefoxProfile()
        profile.set_preference("app.update.enabled", False)
        if firebug:
            profile.add_extension(os.path.join(self.cur_path, 'extensions/firebug-2.0.8.xpi'))
            profile.set_preference("extensions.firebug.currentVersion", "2.0.8")
            profile.set_preference("extensions.firebug.allPagesActivation", "on")
            profile.set_preference("extensions.firebug.defaultPanelName", "net")
            profile.set_preference("extensions.firebug.net.enableSites", True)
            profile.set_preference("extensions.firebug.delayLoad", False)
            profile.set_preference("extensions.firebug.onByDefault", True)
            profile.set_preference("extensions.firebug.showFirstRunPage", False)
            profile.set_preference("extensions.firebug.net.defaultPersist", True)  # persist all redirection responses
        if netexport:
            har_path = os.path.join(self.cur_path, "har")
            if not os.path.exists(har_path):
                os.mkdir(har_path)
            profile.add_extension(os.path.join(self.cur_path, 'extensions/netExport-0.9b7.xpi'))
            profile.set_preference("extensions.firebug.DBG_NETEXPORT", True)
            profile.set_preference("extensions.firebug.netexport.alwaysEnableAutoExport", True)
            profile.set_preference("extensions.firebug.netexport.defaultLogDir", har_path)
            profile.set_preference("extensions.firebug.netexport.includeResponseBodies", True)
        return profile 
Example #23
Source File: sketchfab_download_models.py    From BakeMyScan with GNU General Public License v3.0 5 votes vote down vote up
def setup_Firefox_profile(download_to):
    #Create a firefox profile to automatically download .zip on the Desktop
    profile = webdriver.FirefoxProfile()
    profile.set_preference("browser.download.dir", download_to)
    profile.set_preference("browser.download.folderList", 2)
    profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/zip")
    profile.set_preference( "browser.download.manager.showWhenStarting", False )
    return profile 
Example #24
Source File: twitterphisher.py    From social_attacker with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self,showbrowser):
		display = Display(visible=0, size=(1600, 1024))
		display.start()
		if not showbrowser:
			os.environ['MOZ_HEADLESS'] = '1'
		firefoxprofile = webdriver.FirefoxProfile()
		firefoxprofile.set_preference("permissions.default.desktop-notification", 1)
		firefoxprofile.set_preference("dom.webnotifications.enabled", 1)
		firefoxprofile.set_preference("dom.push.enabled", 1)
		self.driver = webdriver.Firefox(firefox_profile=firefoxprofile)
		self.driver.implicitly_wait(15)
		self.driver.delete_all_cookies() 
Example #25
Source File: config_driver.py    From toolium with Apache License 2.0 5 votes vote down vote up
def _create_firefox_profile(self):
        """Create and configure a firefox profile

        :returns: firefox profile
        """
        # Get Firefox profile
        profile_directory = self.config.get_optional('Firefox', 'profile')
        if profile_directory:
            self.logger.debug("Using firefox profile: %s", profile_directory)

        # Create Firefox profile
        profile = webdriver.FirefoxProfile(profile_directory=profile_directory)
        profile.native_events_enabled = True

        # Add Firefox preferences
        try:
            for pref, pref_value in dict(self.config.items('FirefoxPreferences')).items():
                self.logger.debug("Added firefox preference: %s = %s", pref, pref_value)
                profile.set_preference(pref, self._convert_property_type(pref_value))
            profile.update_preferences()
        except NoSectionError:
            pass

        # Add Firefox extensions
        try:
            for pref, pref_value in dict(self.config.items('FirefoxExtensions')).items():
                self.logger.debug("Added firefox extension: %s = %s", pref, pref_value)
                profile.add_extension(pref_value)
        except NoSectionError:
            pass

        return profile 
Example #26
Source File: crawl.py    From proxy_web_crawler with MIT License 5 votes vote down vote up
def set_current_proxy(self):
        self.fp = webdriver.FirefoxProfile()
        self.fp.set_preference('network.proxy.type', 1)
        self.fp.set_preference('network.proxy.http', self.proxy_host)
        self.fp.set_preference('network.proxy.http_port', self.proxy_port)
        self.fp.set_preference('network.proxy.ssl', self.proxy_host)
        self.fp.set_preference('network.proxy.ssl_port', self.proxy_port)
        self.fp.set_preference('general.useragent.override', self.agent())
        self.fp.update_preferences() 
Example #27
Source File: pinterestfinder.py    From social_mapper with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self,showbrowser):
		display = Display(visible=0, size=(1600, 1024))
		display.start()
		if not showbrowser:
			os.environ['MOZ_HEADLESS'] = '1'
		firefoxprofile = webdriver.FirefoxProfile()
		firefoxprofile.set_preference("permissions.default.desktop-notification", 1)
		firefoxprofile.set_preference("dom.webnotifications.enabled", 1)
		firefoxprofile.set_preference("dom.push.enabled", 1)
		self.driver = webdriver.Firefox(firefox_profile=firefoxprofile)
		self.driver.implicitly_wait(15)
		self.driver.delete_all_cookies() 
Example #28
Source File: facebookfinder.py    From social_mapper with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self,showbrowser):
		display = Display(visible=0, size=(1600, 1024))
		display.start()
		if not showbrowser:
			os.environ['MOZ_HEADLESS'] = '1'
		firefoxprofile = webdriver.FirefoxProfile()
		firefoxprofile.set_preference("permissions.default.desktop-notification", 1)
		firefoxprofile.set_preference("dom.webnotifications.enabled", 1)
		firefoxprofile.set_preference("dom.push.enabled", 1)
		self.driver = webdriver.Firefox(firefox_profile=firefoxprofile)
		self.driver.implicitly_wait(15)
		self.driver.delete_all_cookies() 
Example #29
Source File: linkedinfinder.py    From social_mapper with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self,showbrowser):
		display = Display(visible=0, size=(1600, 1024))
		display.start()
		if not showbrowser:
			os.environ['MOZ_HEADLESS'] = '1'
		firefoxprofile = webdriver.FirefoxProfile()
		firefoxprofile.set_preference("permissions.default.desktop-notification", 1)
		firefoxprofile.set_preference("dom.webnotifications.enabled", 1)
		firefoxprofile.set_preference("dom.push.enabled", 1)
		self.driver = webdriver.Firefox(firefox_profile=firefoxprofile)
		self.driver.implicitly_wait(15)
		self.driver.delete_all_cookies() 
Example #30
Source File: doubanfinder.py    From social_mapper with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self,showbrowser):
		display = Display(visible=0, size=(1600, 1024))
		display.start()
		if not showbrowser:
			os.environ['MOZ_HEADLESS'] = '1'
		firefoxprofile = webdriver.FirefoxProfile()
		firefoxprofile.set_preference("permissions.default.desktop-notification", 1)
		firefoxprofile.set_preference("dom.webnotifications.enabled", 1)
		firefoxprofile.set_preference("dom.push.enabled", 1)
		self.driver = webdriver.Firefox(firefox_profile=firefoxprofile)
		self.driver.implicitly_wait(15)
		self.driver.delete_all_cookies()