Skip to main content

Python library for detecting and launching browsers

Project description

License License Version Version
Github Actions Github Actions Coverage CodeCov
Supported versions Python Versions Wheel Wheel
Status Status Downloads Downloads

browsers

Python library for detecting and launching browsers

I recently wrote a snippet for detecting installed browsers in an OSX machine in https://github.com/mitmproxy/mitmproxy/issues/5247#issuecomment-1095337723 based on https://github.com/httptoolkit/browser-launcher and I thought this could be useful to other devs since I cannot seem to find an equivalent library in Python

Installation

pip install pybrowsers

Usage

Import

import browsers

List all installer browsers

import browsers

print(list(browsers.browsers()))
# [('chrome', {'path': '/Applications/Google Chrome.app', 'display_name': 'Google Chrome', 'version': '100.0.4896.127'}), ('firefox', {'path': '/Applications/Firefox.app', 'display_name': 'Firefox', 'version': '99.0.1'}), ('safari', {'path': '/Applications/Safari.app', 'display_name': 'Safari', 'version': '15.4'}), ('opera', {'path': '/Applications/Opera.app', 'display_name': 'Opera', 'version': '85.0.4341.60'}), ('msedge', {'path': '/Applications/Microsoft Edge.app', 'display_name': 'Microsoft Edge', 'version': '100.1185.22041544'})]

Get browser information

import browsers

print(browsers.get("chrome"))
# {'path': '/Applications/Google Chrome.app', 'display_name': 'Google Chrome', 'version': '100.0.4896.88'}

Launch browser

import browsers

browsers.launch("chrome")

Launch browser with URL

import browsers

browsers.launch("chrome", url="https://github.com/roniemartinez/browsers")

Launch browser with arguments

import browsers

browsers.launch("chrome", args=["--incognito"])

TODO:

  • Detect browser on OSX
  • Detect browser on Linux
  • Detect browser on Windows
  • Launch browser with arguments
  • Get browser by version (support wildcards)

References

Author

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

pybrowsers-0.2.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybrowsers-0.2.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file pybrowsers-0.2.0.tar.gz.

File metadata

  • Download URL: pybrowsers-0.2.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.13.0-1021-azure

File hashes

Hashes for pybrowsers-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b85ba0924d4c9770438cd78905833946a604ff18c22bcbeafbf9f6b4996be8f3
MD5 9d3e06baeb1960f0262ea2693bdbc732
BLAKE2b-256 1c18ea0c4220d19f29f33a8b5c867cdcd52ef1ddc847c38aab08ba85056ae138

See more details on using hashes here.

File details

Details for the file pybrowsers-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pybrowsers-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.13.0-1021-azure

File hashes

Hashes for pybrowsers-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4520e6575326057f54034691ba0a42c6a2bf87eb163c09241da81f73aeb5dc7d
MD5 551f3fe7272c7dbd314724ef9aaf4985
BLAKE2b-256 ebfba92d53c18d6af9abe9d81cc13ca388a91be329ddb79c43c8323f54a7b95e

See more details on using hashes here.

Supported by

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