freebsd-ports/www/py-selenium-wire/pkg-descr
Dan Langille 52bdbca404 www/py-selenium-wire: New port - extends Selenium
Selenium Wire extends Selenium's Python bindings to give you access to
the underlying requests made by the browser. You author your code in the
same way as you do with Selenium, but you get extra APIs for inspecting
requests and responses and making changes to them on the fly.
2022-11-30 20:32:24 +00:00

23 lines
751 B
Text

Selenium Wire extends Selenium's Python bindings to give you access to the
underlying requests made by the browser. You author your code in the same way as
you do with Selenium, but you get extra APIs for inspecting requests and
responses and making changes to them on the fly.
Simnple example:
from seleniumwire import webdriver # Import from seleniumwire
# Create a new instance of the Chrome driver
driver = webdriver.Chrome()
# Go to the Google home page
driver.get('https://www.google.com')
# Access requests via the `requests` attribute
for request in driver.requests:
if request.response:
print(
request.url,
request.response.status_code,
request.response.headers['Content-Type']
)