Skip to main content

Selenium browser controller for apt Firefox on Ubuntu 22.10

Project description

Selenium Browser Controller for apt Firefox on Ubuntu 22.10

![Python 3.10][python_badge] ![License: AGPL v3][agpl3_badge] ![Code Style: Black][black_badge] ![Code Coverage][codecov_badge]

Initialises a Selenium browser controller for a specific firefox profile on an Ubuntu 22.10 system for an apt installation of Firefox.

Put into a separate pip package to remove boiler-plate code from other repositories that control the browser.

Usage

First install this pip package with:

pip install browsercontroller

Then run:

from browsercontroller.get_controller import (
    get_ubuntu_apt_firefox_controller,
)

get_ubuntu_apt_firefox_controller(url="https://www.startpagina.nl")

Hide automation/"are u human?"

Some entities use checks to verify you are human. at 20223-09-19 those can be evaded using either:

  • playwright
  • puppeteer

Installation playwright

pip install playwright
playwright install

Installation puppeteer

npm install puppeteer
npm install puppeteer-extra-plugin-stealth
npm install puppeteer puppeteer-extra puppeteer-extra-plugin-stealth
# Then run the example script with:
node puppeteer_stealth.js

Drawback playwright implementation

An example of each of those two options is included. One drawback of the way playwright is used in this repository, is that the entire sequence of actions must occur within a single method, because the playwright browsercontroller is created within a Python with statement, and returning the Page object from the initialisation function: initialise_playwright_browsercontroller() yields "loop closed error."

Drawback puppeteer

It is implemented in javascript. Pypeteer is an archived Python approximation of puppeteer. However, that is limited in its functionalities and not supported anymore.

Warning: Checks whether a snap version of Firefox is installed, and if yes, removes it and installs an apt version of Firefox instead. You'll lose browser history, logins and bookmarks if you don't have an apt version of Firefox.

Updating

Build the pip package with:

pip install --upgrade pip setuptools wheel
pip install twine

Install the pip package locally with:

pip install -e .

Upload the pip package to the world with:

rm -r dist
rm -r build
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/\*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

browsercontroller-0.0.12.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

browsercontroller-0.0.12-py2.py3-none-any.whl (4.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file browsercontroller-0.0.12.tar.gz.

File metadata

  • Download URL: browsercontroller-0.0.12.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for browsercontroller-0.0.12.tar.gz
Algorithm Hash digest
SHA256 1ebb5d76c3a07d0dbd3e6d090803f981b095e3dca3a1485683921eb8dc2ab1e1
MD5 75f023f6cbb75d2bd40ce2cf20e46145
BLAKE2b-256 421ded31e5fedfab2b78bbe591d5ddd7db0c54bc7fcabcc69f08a85dfb032508

See more details on using hashes here.

File details

Details for the file browsercontroller-0.0.12-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for browsercontroller-0.0.12-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7f72c80a021bdc0bff2395a5d52f42428f54697a2add4026a89626626abb24d9
MD5 13c3aae2dc78ded3680c98a12dafe4a4
BLAKE2b-256 4beb07937c42fabfed679556633b6555aaeb58e023634af6859c9e1cbdfdfd1c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page