From d23644150ef71ea53c174faf0f488039e485b1a1 Mon Sep 17 00:00:00 2001 From: Radwan Faris Date: Wed, 27 Sep 2023 13:32:42 +0300 Subject: [PATCH] Update README.rst I was trying to run the browser in headless mode, but that's not explained in the project documentation, so I had to read through the code and found that you use the undetected-chromedriver project. I read their documentation to figure out how to run the browser in headless mode. I think adding this information to the project documentation will save time for other developers. --- README.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.rst b/README.rst index ec3e3bc..0d7fb9b 100644 --- a/README.rst +++ b/README.rst @@ -194,6 +194,25 @@ Then just instantiate the webdriver as you would if you were using Selenium dire seleniumwire_options={...} ) +By default, the webdriver will not be in headless mode. To run it in headless mode, you can do the following: + +.. code:: python + + from seleniumwire.webdriver import Chrome + from selenium.webdriver.chrome.options import Options + + # to run the browser in headless mode, add the following argument: + chrome_options = Options() + chrome_options.add_argument("--headless") + + # add your your selenium-wire Options here ex. proxy + sw_options = {} + + + driver = Chrome(seleniumwire_options=sw_options, chrome_options=chrome_options) + + + .. _`own options`: #all-options Note that for sub-packages of ``webdriver``, you should continue to import these directly from ``selenium``. For example, to import ``WebDriverWait``: