Skip to main content

Intercept requests using Selenium with Chrome

Project description

Selenium-Interceptor

  • Modifying or adding headers(#Change-headers)
  • Modify response

Feel free to test my code!

Getting Started

Dependencies

Installing

Change-headers

from selenium_profiles.scripts.cdp_tools import cdp_listener

# Note: driver allready initialized

cdp_listener = cdp_listener(driver=driver)
cdp_listener.specify_headers({"sec-ch-ua-platform":"Android"})
thread = cdp_listener.start_threaded(listeners= {
                                                "header_mod":{"listener":cdp_listener.all_requests,"at_event":cdp_listener.modify_headers},
                                                 })
driver.get("https://modheader.com/headers?product=ModHeader")

Don't forget to execute driver.quit() in the End. Else-wise your temporary folder will get flooded! (Windows)

Help

Please feel free to open an issue or fork!

Todo

Deprecated

Authors

Aurin Aegerter

License

Shield: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

CC BY-NC-SA 4.0

Disclaimer

I am not responsible what you use the code for!!! Also no warranty!

Acknowledgments

Inspiration, code snippets, etc.

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

selenium_interceptor-1.0.0.tar.gz (4.8 kB view hashes)

Uploaded Source

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