Skip to main content

Selenium based, user friendly Browser Automation API

Project description

pybrowser

For documentation, refer here

Here is a quick example,

from pybrowser import Browser 
    with Browser(browser_name=Browser.CHROME) as b:
        b.goto("https://www.google.com/")
        b.input("name:=q").enter("news")
        b.button("name:=btnK").click()
        screenshot_path = b.take_screenshot()
        print(b.html().elements.links())

Release Notes:

0.2.0

  • Changes

    • Changes in underlying Browser.requests_session object,

      • requests_session.result has been removed. There is just requests_session.response which is a blocking call (in case asynch flag is set). Also note, requests_session.is_request_done is still available to see if request is complete of not. There are no changes to other properties and are blocking in case of asynchronous call.

      • requests_session.content() method with options for bytes and text has been changed to properties, just like in underlying requests. That is now you call, requests_session.content for bytes and requests_session.text for text.

      • In context of above changes, Browser object also has below changes,

        • Browser.get and Browser.post now returns requests_session object (used to be requests_session.response).
        • Browser.content() has been changed to properties. That is now you call, Browser.content for bytes and Browser.text for text.
  • New features

    • Support for remote url. Please note this requires Selenium Grid to be setup explicitly. Once done use the URL here.

    • Flags for Opera browser (Browser.OPERA). Webdriver executable needs to be present in driver_path. Please note EDGE and SAFARI are also supported the same way. That is, webdriver isn't automatically downloaded, instead path needs to be provided.

0.1.0

  • Changes

    Please note some key changes with regards to properties changing to methods.

    • Methods which were properties in initial release are now method calls. Below is the impacted list.

      In Browser,

      • Browser.refresh()
      • Browser.back()
      • Browser.forward()
      • Browser.maximize_window()
      • Browser.minimize_window()
      • Browser.fullscreen_window()
      • Browser.delete_all_cookies()
      • Browser.close()

      In Action (used by all elements),

      • Action.refresh()
      • Action.highlight()
      • Action.double_click()
      • Action.move_to_element()

      Specific elements also,

      • Checkbox.check()
      • Checkbox.uncheck()
      • Radio.select()
      • Radio.unselect()
      • Input.clear()
    • Browser class __init__ method now has more options,

      • firefox_binary_path
      • firefox_profile_path
      • http_proxy
      • driver_path
    • Select element has below method changes,

      Select.options(get="text") method has been split to multiple properties to keep it simple,

      • Select.options_text
      • Select.options_value
      • Select.options_element

      Similar change has been done for Select.all_selected_options(get="text"),

      • Select.all_selected_options_text
      • Select.all_selected_options_value
      • Select.all_selected_options_element
    • File element changes,

      Below enhancements have been made to download feature,

      • Added more parameters -

        • unzip - Set this flag to unzip file. Default is False
        • del_zipfile - Set this flag to delete zip file after it has been unzipped. Default is False
        • add_to_ospath - Set this flag to add directory to PATH. Default is False
      • New properties -

        As you might already know, download happens in background (asynchronous) by default and can of course be changed with asynch. To check if download was successful, below properties are available,

        • is_download_complete - True or False
        • downloaded_files - list of downloaded files
    • HTML links method has below method changes,

      This is the one you would invoke via Browser as Browser.html().elements.link().

      • Added more parameters -

        • images - You can filter out images. Default is False that means to include images, you will need to set this to True
        • name_length_limit - This limits the length of name of the url. Default is 60
      • Change in return type. Before this change, return type was a list of types (name, url). This has been changed to list of named_tuples of form ('Link', ['name', 'url'])

    • Changes in some env options.

      Removed below options as they don't have sense. Either you provide complete driver download url or provide version so that the API tries to download,

      • CHROME_FILENAME
      • IE_FILENAME
      • CHROMEDRIVER_DEFAULT_VERSION

      Added below for Firefox support,

      • FIREFOX_HOME_URL
      • FIREFOX_DOWNLOAD_URL
      • FIREFOXDRIVER_VERSION
    • Refactoring (non functional) in code and tests. Lot more testing needed still :-\

  • New features

    • Support for Firefox !

0.0.1

  • Very first release !

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

get-pybrowser-0.2.0.tar.gz (39.0 kB view details)

Uploaded Source

Built Distribution

get_pybrowser-0.2.0-py3-none-any.whl (47.5 kB view details)

Uploaded Python 3

File details

Details for the file get-pybrowser-0.2.0.tar.gz.

File metadata

  • Download URL: get-pybrowser-0.2.0.tar.gz
  • Upload date:
  • Size: 39.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0

File hashes

Hashes for get-pybrowser-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c306744569d2af04b07a917ef9fe8591e7daaedd7dd9661b0167b255c327f22d
MD5 c94bbf95812924154629f51d188044b2
BLAKE2b-256 674e01a7dcac75fd754ff188202f9f328196e1be08fbee361d3e51d0383565b6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: get_pybrowser-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 47.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0

File hashes

Hashes for get_pybrowser-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 03e5097b60512fb8be6d132ad653f13fbae1a116bd297ae6d8ac462652168a85
MD5 aa72002ddc2191e27c4fead419527d53
BLAKE2b-256 9a531adda79b79a920ca777d458dbceeaf00ce4738e3db941fef833efa91b126

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