Chrome & Firefox extensions

Import Chrome & Firefox extensions into a Browser instance

Firefox/Chrome extensions can be easily imported into a browser session. Some potentially useful extensions include:

Firefox extensions are Firefox-only, and Chrome extensions are Chrome-only.

If you plan on using Firefox-specific or Chrome-specific extensions, make sure to set your browser parameter to the correct browser before rendering the page:

# when dealing with captchas, make sure to use firefox
>>> resp = hrequests.get('https://accounts.hcaptcha.com/demo', browser='firefox')

Extensions are added with the extensions parameter:

  • This can be an list of absolute paths to unpacked extensions:

    with resp.render(extensions=['C:\\extensions\\hektcaptcha', 'C:\\extensions\\ublockorigin']):
  • Or a folder containing the unpacked extensions:

    with resp.render(extensions='C:\\extentions'):

    Note that these need to be unpacked extensions. You can unpack a .crx file by changing the file extension to .zip and extracting the contents.

Usage example of using a captcha solver:

>>> resp = hrequests.get('https://accounts.hcaptcha.com/demo', browser='firefox')
>>> with resp.render(extensions=['C:\\extensions\\hektcaptcha']) as page:
...     page.awaitSelector('.hcaptcha-success')  # wait for captcha to finish
...     page.click('input[type=submit]')

Last updated