Getting Started
Introduction
The logikal-browser package provides a convenient high-level interface for web browser management
and automation (with Selenium). First, define the appropriate
browser versions that should be used in your pyproject.toml
file:
[tool.browser.versions]
chrome = '132.0.6834.83'
edge = '132.0.2957.115'
Then create the desired Browser
sub-class instance:
from logikal_browser.chrome import ChromeBrowser
from logikal_browser.scenarios import desktop
browser = ChromeBrowser(settings=desktop.settings)
browser.get('https://logikal.io')
browser.check()
That’s it! The correct web browser and web driver will be automatically installed, and the enhanced
WebDriver
instance can be used straightaway.
Installation
You can simply install logikal-browser
from pypi:
pip install logikal-browser
Note
If your system uses AppArmor, you may need to add a new profile that allows unconfined execution of the developer build browser binaries. For example, in the case of Chrome:
# Based on /etc/apparmor.d/chrome
abi <abi/4.0>,
include <tunables/global>
profile chrome-dev /@{HOME}/.cache/logikal_browser/chrome/**/chrome flags=(unconfined) {
userns,
include if exists <local/chrome>
}
Extras
django
The Django extra provides the necessary requirements for the logikal_browser.Browser.login()
method:
pip install logikal-browser[django]