Discussion:
[selenium-users] Experimental flags with Chrome webdriver
Pascal H
7 years ago
Permalink
Hi, I'm trying to enable experimental flags when launching Chrome with web
driver :

I did the following :

from selenium.webdriver.chrome.options import Options
myOptions = Options()
myOptions.add_argument("--enable-quic")
myOptions.add_argument("--enable-tcp-fast-open")
driver = webdriver.Chrome(chrome_options=myOptions)

Now, in chrome://version, I have :

Command Line /usr/bin/google-chrome --disable-background-networking
--disable-client-side-phishing-detection --disable-default-apps
--disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost
--disable-sync --disable-web-resources --enable-automation --enable-logging *--enable-quic
--enable-tcp-fast-open* --force-fieldtrials=SiteIsolationExtensions/Control
--ignore-certificate-errors
--load-extension=/tmp/.org.chromium.Chromium.8w4LVP/internal --log-level=0
--metrics-recording-only --no-first-run --password-store=basic
--remote-debugging-port=0 --test-type=webdriver --use-mock-keychain
--user-data-dir=/home/woo/myTEmp --flag-switches-begin --flag-switches-end


And in chrome://flags, neither QUIC nor Fast Open is enabled.
If I change manually the QUIC and Fast Open option in chrome://flags and
click on relaunch, I will now have :
Command Line /usr/bin/google-chrome --disable-background-networking
--disable-client-side-phishing-detection --disable-default-apps
--disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost
--disable-sync --disable-web-resources --disk-cache-size=1
--enable-automation --enable-logging *--enable-quic --enable-tcp-fast-open*
--force-fieldtrials=SiteIsolationExtensions/Control
--ignore-certificate-errors
--load-extension=/tmp/.org.chromium.Chromium.8w4LVP/internal --log-level=0
--media-cache-size=1 --metrics-recording-only --no-first-run
--password-store=basic --remote-debugging-port=0 --test-type=webdriver
--use-mock-keychain --user-data-dir=/home/woo/myTEmp --flag-switches-begin *--enable-quic
--enable-tcp-fastopen* --flag-switches-end

(And in chrome://flags I do have the QUIC and Fast Open Options)
So it appears to me that to enable experimental flags, they need to be
located between the
"--flag-switches-begin" and "--flag-switches-end".

So, is there any way to tell Selenium to set the options within those 2
flags ?

Regards,
Pascal
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/05d0b730-b447-4bd9-bf89-c43009136e90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Pascal H
7 years ago
Permalink
For anyone interested, I found this workaround (pretty complex :p), but
didn't find a way to enable this through Selenium functions.

Regards, Pascal

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time

## Browser config javascript commands (need to be launched from
chrome://flags)
enable_quic_command = "chrome.send('enableExperimentalFeature',['enable-quic'
+ '@' + 1, 'true'])"
enable_fastopen_command = "chrome.send('enableExperimentalFeature',
['enable-tcp-fast-open', 'true'])"

def chrome_configure_experimental_flags(myDriver):
myDriver.get('chrome://flags') #Load page where configuration javascript
commands are allowed
myDriver.execute_script(enable_quic_command) #Enable QUIC
myDriver.execute_script(enable_fastopen_command) #Enable TCP
myDriver.get('chrome://flags') #Re-load so that we can check
time.sleep(2) #Give some time to check the flag


myOptions = Options()
#Set disk and media cache size to disable caching
myOptions.add_argument("--disk-cache-size=1")
myOptions.add_argument("--media-cache-size=1")
#Set our own, to be re-used, profile
profile_folder = '/tmp/' + 'profile_chrome_' + time_string
myOptions.add_argument("user-data-dir=" + profile_folder)

#Create driver
driver = webdriver.Chrome(chrome_options=myOptions)
#Set experimental features
chrome_configure_experimental_flags(driver)
#Close and re-build driver with same options (and so same profile, so
experimental flags will be kept)
driver.close()
driver = webdriver.Chrome(chrome_options=myOptions)
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/bb7b984d-6761-41f8-b2db-4458de9a1355%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Shawn McCarthy
7 years ago
Permalink
what kind of different do you see with these two flags ?
...
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/bf1a231a-f9a1-4b1a-9aa8-814422f8743a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Pascal H
7 years ago
Permalink
Hi Shawn,
I'm studying transport-layer protocols and their performance when accessing
Internet through a satellite.
Thanks to those two flags, Chrome will here use the QUIC protocol and the
TFO option of TCP whenever possible.
And then I use Selenium to register some performance metrics with Chrome
when accessing different type of services on different servers, with
different transport layer protocols.
Regards,
Pascal
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/a04f9c8e-8204-4d85-abc9-dc591dbd25d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...