You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 3, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.rst
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,12 +126,12 @@ Install using pip:
126
126
127
127
pip install selenium-wire
128
128
129
-
If you get an error about not being able to build cryptography, you may be running an old version of pip. Try upgrading pip with ``python -m pip install --upgrade pip``, and then re-run the above command.
129
+
If you get an error about not being able to build cryptography you may be running an old version of pip. Try upgrading pip with ``python -m pip install --upgrade pip`` and then re-run the above command.
130
130
131
131
Browser Setup
132
132
-------------
133
133
134
-
No specific configuration should be necessary except to ensure that you have downloaded the `ChromeDriver`_ and `GeckoDriver`_ for Chrome and Firefox to be remotely controlled - the same as if you were using Selenium directly. Once downloaded, these executables should be placed somewhere on your PATH.
134
+
No specific configuration should be necessary except to ensure that you have downloaded the `ChromeDriver`_ and `GeckoDriver`_ for Chrome and Firefox to be remotely controlled, the same as if you were using Selenium directly. Once downloaded, these executables should be placed somewhere on your PATH.
@@ -183,7 +183,7 @@ For sub-packages of ``webdriver``, you should continue to import these directly
183
183
184
184
**Chrome and Firefox**
185
185
186
-
For Chrome and Firefox, you don't need to do anything special. Just instantiate the webdriver as you would normally with ``webdriver.Chrome()`` or ``webdriver.Firefox()`` passing in any `desired capabilities`_ and browser specific options for `Chrome`_ or `Firefox`_ , such as the executable path, headless mode etc. Selenium Wire also has it's `own options`_ that can be passed in the ``seleniumwire_options`` attribute.
186
+
For Chrome and Firefox you don't need to do anything special. Just instantiate the webdriver as you would normally with ``webdriver.Chrome()`` or ``webdriver.Firefox()`` passing in any `desired capabilities`_ and browser specific options for `Chrome`_ or `Firefox`_ , such as the executable path, headless mode etc. Selenium Wire also has it's `own options`_ that can be passed in the ``seleniumwire_options`` attribute.
@@ -204,7 +204,7 @@ Selenium Wire has limited support for using the remote webdriver client. When yo
204
204
seleniumwire_options=options
205
205
)
206
206
207
-
If the machine running the browser needs to use a different address to talk to the machine running Selenium Wire, you need to configure the browser manually. `This issue <https://github.com/wkeeling/selenium-wire/issues/220>`_ goes into more detail.
207
+
If the machine running the browser needs to use a different address to talk to the machine running Selenium Wire you need to configure the browser manually. `This issue <https://github.com/wkeeling/selenium-wire/issues/220>`_ goes into more detail.
208
208
209
209
Accessing Requests
210
210
~~~~~~~~~~~~~~~~~~
@@ -218,7 +218,7 @@ Selenium Wire captures all HTTP/HTTPS traffic made by the browser [1]_.
218
218
Convenience attribute for retrieving the most recently captured request. This is more efficient than using ``driver.requests[-1]``.
219
219
220
220
``driver.wait_for_request(pat, timeout=10)``
221
-
This method will wait until it sees a request matching a pattern. The ``pat`` attribute will be matched within the request URL. ``pat`` can be a simple sub-string or a regex. Note that ``driver.wait_for_request()`` doesn't *make* a request, it just *waits* for a previous request made by some other action - and it will return the first request it finds. Also note that since ``pat`` can be a regex, you must escape special characters such as question marks with a slash. A ``TimeoutException`` is raised if no match is found within the timeout period.
221
+
This method will wait until it sees a request matching a pattern. The ``pat`` attribute will be matched within the request URL. ``pat`` can be a simple sub-string or a regex. Note that ``driver.wait_for_request()`` doesn't *make* a request, it just *waits* for a previous request made by some other action and it will return the first request it finds. Also note that since ``pat`` can be a regex, you must escape special characters such as question marks with a slash. A ``TimeoutException`` is raised if no match is found within the timeout period.
222
222
223
223
For example, to wait for an AJAX request to return after a button is clicked:
224
224
@@ -231,7 +231,7 @@ Selenium Wire captures all HTTP/HTTPS traffic made by the browser [1]_.
A JSON formatted HAR archive of HTTP transactions that have taken place. HAR capture is turned off by default, and you must set the ``enable_har`` `option`_ to ``True`` before using ``driver.har``.
234
+
A JSON formatted HAR archive of HTTP transactions that have taken place. HAR capture is turned off by default and you must set the ``enable_har`` `option`_ to ``True`` before using ``driver.har``.
235
235
236
236
``driver.iter_requests()``
237
237
Returns an iterator over captured requests. Useful when dealing with a large number of requests.
@@ -290,7 +290,7 @@ Request objects have the following attributes.
290
290
The request URL, e.g. ``https://server/some/path/index.html?foo=bar&spam=eggs``
291
291
292
292
``ws_messages``
293
-
Where the request is a websocket handshake request (normally with a URL starting ``wss://``), then ``ws_messages`` will contain a list of any websocket messages sent and received. See `WebSocketMessage Objects`_.
293
+
Where the request is a websocket handshake request (normally with a URL starting ``wss://``) then ``ws_messages`` will contain a list of any websocket messages sent and received. See `WebSocketMessage Objects`_.
294
294
295
295
Request objects have the following methods.
296
296
@@ -480,7 +480,7 @@ To unset an interceptor, use ``del``:
480
480
Limiting Request Capture
481
481
~~~~~~~~~~~~~~~~~~~~~~~~
482
482
483
-
Selenium Wire works by redirecting browser traffic through an internal proxy server it spins up in the background. As requests flow through the proxy they are intercepted and captured. Capturing requests can slow things down a little, but there are a few things you can do to restrict what gets captured.
483
+
Selenium Wire works by redirecting browser traffic through an internal proxy server it spins up in the background. As requests flow through the proxy they are intercepted and captured. Capturing requests can slow things down a little but there are a few things you can do to restrict what gets captured.
484
484
485
485
``driver.scopes``
486
486
This accepts a list of regular expressions that will match the URLs to be captured. It should be set on the driver before making any requests. When empty (the default) all URLs are captured.
@@ -499,7 +499,7 @@ Selenium Wire works by redirecting browser traffic through an internal proxy ser
499
499
Note that even if a request is out of scope and not captured, it will still travel through Selenium Wire.
500
500
501
501
``seleniumwire_options.disable_capture``
502
-
Use this option to switch off request capture. Requests will still pass through Selenium Wire and through any upstream proxy you have configured, but they won't be stored.
502
+
Use this option to switch off request capture. Requests will still pass through Selenium Wire and through any upstream proxy you have configured but they won't be stored.
503
503
504
504
.. code:: python
505
505
@@ -588,7 +588,7 @@ The proxy configuration can also be loaded through environment variables called
588
588
SOCKS
589
589
-----
590
590
591
-
Using a SOCKS proxy is the same as using an HTTP based one, but with the scheme set to ``socks5``:
591
+
Using a SOCKS proxy is the same as using an HTTP based one but you set the scheme to ``socks5``:
592
592
593
593
.. code:: python
594
594
@@ -616,7 +616,7 @@ Selenium Wire will automatically integrate itself with `undetected-chromedriver`
If you wish to take advantage of this, make sure you have undetected-chromedriver installed:
619
+
If you wish to take advantage of this make sure you have undetected-chromedriver installed:
620
620
621
621
.. code:: bash
622
622
@@ -638,7 +638,7 @@ Then just use ``webdriver.Chrome()`` as you would normally, making sure that you
638
638
639
639
The first time you run the webdriver it will download and patch the ChromeDriver binary in the background.
640
640
641
-
You can check that undetected_chromedriver is being used by looking for the log messages it generates. You just need to ensure that you've activated logging at the top of your script or program first - for example:
641
+
You can check that undetected_chromedriver is being used by looking for the log messages it generates. You just need to ensure that you've activated logging at the top of your script or program first, for example:
0 commit comments