Skip to main content

fBrowser | Quick-start Your Selenium Project

This library was created in order to help users quick-start their webscraping project. It includes several useful functions including a browser handler, new tab functionality, and more.

Installation

$ pip3 install fBrowser

Usage

Browser Handler

You can decorate your function with a browserHandler. This will create the driver and properly quit it if an exception occurs or when the program ends.

from time import sleep
from fBrowser import browserHandler


@browserHandler()
def main(driver):
    driver.get('https://www.google.com')
    sleep(5)


main()

You can also pass in these optional arguments:

@browserHandler(path='', firefox=False, proxy='<host/ip>:<port>',
                headless=True, implicitWaitTime=60, incognito=True)

New Tab

Run a function in a new tab of Chrome. It will automatically close and switch contexts when it finishes executing.

You can use the newTab function to decorate your selenium functions. Doing so will execute your function in a new tab of the browser. Your decorated function must have its first parameter for the webdriver.

from time import sleep
from fBrowser import browserHandler, newTab


@newTab
def loadTheVerge(driver):
    driver.get('https://www.theverge.com')
    sleep(2)


@browserHandler()
def main(driver):
    driver.get('https://www.google.com')
    sleep(2)
    loadTheVerge(driver)


main()

Login

Use this helper function to login into a site. Simply pass in your email / username and your password. (This function assumes that the input tags in the form have attributes @type=username, @type=email, or @type=password).

import fBrowser
from fBrowser import browserHandler


@browserHandler()
def main(driver):
    driver.get(
        'https://stackoverflow.com/users/login')
    fBrowser.login(driver, email='testing@gmail.com', password='abc123')


main()

Fill Inputs

Quickly fill multiple inputs with either a single value or multiple values.

import fBrowser
from fBrowser import browserHandler


@browserHandler()
def main(driver):
    driver.get('example.com')
    # A list of xpaths to the inputs
    xpaths = ['//*[@name="foo"]', '//*[@name="bar"]', '//@name="fooBar"']

    # Fill with multiple values
    fBrowser.fillInputs(driver, xpaths, ['value1', 'value2', 'value3'])

    # Or pass in one value
    fBrowser.fillInputs(driver, xpaths, 'hello world')


main()

Human Type

Don't want to get flagged as a bot? Fill your inputs using a human-like typing speed.

import fBrowser
from time import sleep
from fBrowser import browserHandler


@browserHandler()
def main(driver):
    driver.get('https://www.google.com')
    chatInput = driver.find_element_by_xpath('//*[@name="q"]')
    # Will input the string at a human-like typing speed
    fBrowser.humanType(driver, chatInput, 'Hello world!')
    sleep(5)


main()

Contributing

  1. Fork it (https://github.com/FastestMolasses/fBrowser/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Metadata

Release files for fBrowser 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fBrowser 0.3.1
File Size Uploaded
fBrowser-0.3.1.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fBrowser 0.3.1
File Interpreter ABI Platform
fBrowser-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / fBrowser-0.3.1.tar.gz

Download URL fBrowser-0.3.1.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
19f73fb6e958713362783409c45e64bc6ea7a7451ca9fc76429ca282e3fd1506
BLAKE2b-256 checksum
How to use checksums
e29c8710a94af6918721482c9e2f8cc07073305dc4d63501cbb8b163265817b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release files / fBrowser-0.3.1-py3-none-any.whl

Download URL fBrowser-0.3.1-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57b22faa245d86076e7d10b5bfd49e4c3afc0d5bbde2715ff4151a00bb03cf36
BLAKE2b-256 checksum
How to use checksums
1bdc3954ef04593db7a54ec84a4fa62ed2bcb9c4828e5667c3bca67bc0234910
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.2.6

1 release file

0.2.5

1 release file

0.2.1

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page