Home > Back-end >  Meaning of Selenium ChromeOptions
Meaning of Selenium ChromeOptions

Time:09-17

I had a lot of issues with Selenium working in headless mode. So, I added these options to my ChromeOptions object:

  1. --proxy-server='direct://'
  2. --proxy-bypass-list=*
  3. --disable-dev-shm-usage
  4. --disable-browser-side-navigation

I saw that it helped the Selenium work faster and give better results in the headless mode, but I don't understand the real meaning of each option. What does each option does?

CodePudding user response:

--proxy-server

Uses a specified proxy server, overrides system settings. This switch only affects HTTP and HTTPS requests.


--proxy-bypass-list

Specifies a list of hosts for whom we bypass proxy settings and use direct connections. Ignored unless --proxy-server is also specified. This is a comma-separated list of bypass rules.

See for more details: https://source.chromium.org/chromium/chromium/src/ /main:net/proxy_resolution/proxy_bypass_rules.h?q=net/proxy_resolution/proxy_bypass_rules.h&ss=chromium


--disable-dev-shm-usage

The /dev/shm partition is too small in certain VM environments, causing Chrome to fail or crash. Use this flag to work-around this issue (a temporary directory will always be used to create anonymous shared memory files).

See the bug details: https://bugs.chromium.org/p/chromium/issues/detail?id=715363


--disable-browser-side-navigation

Whenever you are loading some page with the help of selenium driver, then driver script wait till page is completely loaded. But sometimes webdriver takes more time to load a page, in that case, you will see the TimeoutException exception in your console. So you need to stop downloading additional subresources (images, CSS, js, etc) you can change the pageLoadStrategy through the webdriver

Reference: Timed out receiving message from renderer: 0.100 log messages using ChromeDriver and Chrome v80 through Selenium Java


Reference: https://peter.sh/experiments/chromium-command-line-switches/#proxy-server

  • Related