Selenium based, user friendly Browser Automation API
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())
Changes in underlying
requests_session.resulthas been removed. There is just
requests_session.responsewhich is a blocking call (in case
asynchflag is set). Also note,
requests_session.is_request_doneis 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.contentfor bytes and
In context of above changes,
Browserobject also has below changes,
requests_sessionobject (used to be
Browser.content()has been changed to properties. That is now you call,
Browser.contentfor bytes and
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
SAFARIare also supported the same way. That is, webdriver isn't automatically downloaded, instead path needs to be provided.
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 Action (used by all elements),
Specific elements also,
__init__method now has more options,
Select element has below method changes,
Select.options(get="text")method has been split to multiple properties to keep it simple,
Similar change has been done for
File element changes,
Below enhancements have been made to download feature,
Added more parameters -
unzip- Set this flag to unzip file. Default is
del_zipfile- Set this flag to delete zip file after it has been unzipped. Default is
add_to_ospath- Set this flag to add directory to
PATH. Default is
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,
downloaded_files- list of downloaded files
HTML links method has below method changes,
This is the one you would invoke via Browser as
Added more parameters -
images- You can filter out images. Default is
Falsethat means to include
images, you will need to set this to
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,
Added below for Firefox support,
Refactoring (non functional) in code and tests. Lot more testing needed still :-\
- Support for Firefox !
- Very first release !
|Filename, size & hash||File type||Python version||Upload date|
|get_pybrowser-0.2.0-py3-none-any.whl (47.5 kB) View hashes||Wheel||py3|
|get-pybrowser-0.2.0.tar.gz (39.0 kB) View hashes||Source||None|
Hashes for get_pybrowser-0.2.0-py3-none-any.whl