Python selenium.webdriver.firefox.firefox_binary.FirefoxBinary() Examples
The following are 8
code examples of selenium.webdriver.firefox.firefox_binary.FirefoxBinary().
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.firefox.firefox_binary
, or try the search function
.
Example #1
Source File: foctor_core.py From centinel with MIT License | 6 votes |
def crawl_setup(tor=False, capture_path="", display_mode=0, port="9000", process_tag="1", exits="US"): tor_call = "" make_folder(capture_path) if tor is True: profile_ = setup_profile(tor=True, port=port, firebug=True, netexport=True, noscript=False, capture_path=capture_path) torrc_file = create_tor_config(port, "./torrc-" + process_tag, exits) tor_call = start_program("/usr/sbin/tor -f " + torrc_file) else: profile_ = setup_profile(firebug=True, netexport=True, noscript=False, capture_path=capture_path) display_ = Display(visible=0, size=(1024, 768)) if display_mode == 0: display_.start() binary = FirefoxBinary("./firefox/firefox") driver_ = webdriver.Firefox(firefox_profile=profile_, firefox_binary=binary) driver_.set_page_load_timeout(60) driver_.set_script_timeout(60) return driver_, display_, tor_call
Example #2
Source File: browser_mgmt.py From warriorframework with Apache License 2.0 | 5 votes |
def __init__(self, *args, **kwargs): """Browser management constructor """ self.current_browser = None self.current_window = None self.ff_binary_object = FirefoxBinary()
Example #3
Source File: googlegroupsscraper.py From newspaper-crawler-scripts with GNU General Public License v3.0 | 5 votes |
def _get_driver(self): """ Get the web-driver for the scraper. """ binary = FirefoxBinary('~/bin/geckodriver') browser = webdriver.Firefox(firefox_binary=binary) driver = webdriver.Firefox() driver.implicitly_wait(30) return driver
Example #4
Source File: rebreakcaptcha.py From rebreakcaptcha with MIT License | 5 votes |
def __init__(self): os.environ["PATH"] += os.pathsep + GECKODRIVER_BIN self.driver = webdriver.Firefox(firefox_binary=FirefoxBinary(FIREFOX_BIN_PATH))
Example #5
Source File: test.py From epater with GNU General Public License v3.0 | 5 votes |
def setUp(self): #self.driver = webdriver.Chrome() from selenium.webdriver.firefox.firefox_binary import FirefoxBinary binary = FirefoxBinary('/gel/usr/yahog/browser/firefox/firefox') self.driver = webdriver.Firefox(firefox_binary=binary) self.driver.implicitly_wait(30) #self.base_url = "http://127.0.0.1:8000/" #self.base_url = "http://gif1001-sim.gel.ulaval.ca/?sim=nouveau#tabsmain-simulation" self.base_url = "http://gif1001-sim.gel.ulaval.ca/?page=tp&sim=debug#tabsmain-simulation" self.verificationErrors = [] self.accept_next_alert = True
Example #6
Source File: base.py From django-functest with BSD 3-Clause "New" or "Revised" License | 5 votes |
def get_webdriver_options(cls): kwargs = super(FirefoxBase, cls).get_webdriver_options() if cls.firefox_binary is not None: from selenium.webdriver.firefox.firefox_binary import FirefoxBinary kwargs['firefox_binary'] = FirefoxBinary(firefox_path=cls.firefox_binary) return kwargs # Chrome/ChromeDriver don't work on Travis # https://github.com/travis-ci/travis-ci/issues/272
Example #7
Source File: instagramcrawler.py From InstagramCrawler with MIT License | 5 votes |
def __init__(self, headless=True, firefox_path=None): if headless: print("headless mode on") self._driver = webdriver.PhantomJS() else: # credit to https://github.com/SeleniumHQ/selenium/issues/3884#issuecomment-296990844 binary = FirefoxBinary(firefox_path) self._driver = webdriver.Firefox(firefox_binary=binary) self._driver.implicitly_wait(10) self.data = defaultdict(list)
Example #8
Source File: headless_browser.py From centinel with MIT License | 4 votes |
def run(self, input_files, url=None, verbose=0): """ run the headless browser with given input if url given, the proc will only run hlb with given url and ignore input_list. :param url: :param input_files: the name of the file in "index url" format. i.e. 1, www.facebook.com 1, www.google.com ... :param verbose: :return: """ if not url and not input_files: logging.warning("No input file") return {"error": "no inputs"} results = {} self.open_virtual_display() if verbose > 0: log_file = sys.stdout else: log_file = None # set up firefox driver self.binary = FirefoxBinary(os.path.join(self.cur_path, 'firefox/firefox'), log_file=log_file) self.profile = self.setup_profile() self.driver = webdriver.Firefox(firefox_profile=self.profile, firefox_binary=self.binary, timeout=60) self.driver.set_page_load_timeout(60) isfile = False if url: host, path = self.divide_url(url) results[url] = self.get(host, path) else: isfile = True for input_file in input_files.items(): logging.info("Testing input file %s..." % (input_file[0])) self.run_file(input_file, results) # foctor_core will quit the driver by itself so we only quit the driver when we don't use foctor core if not isfile: logging.info("Quit driver") self.driver.quit() self.close_virtual_display() logging.debug("Deleting har folder") shutil.rmtree(os.path.join(self.cur_path, 'har')) return results