Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
JustAnother
Posts : 1
Join date : 2012-06-01

Chrome driver's ChromeOptions persisting across calls - Python selenium bindings Empty Chrome driver's ChromeOptions persisting across calls - Python selenium bindings

Fri Jun 01, 2012 10:18 pm
I am using the Python selenium bindings to automate Chrome. In order to configure it, I use webdriver.ChromeOptions().arguments, and it seems that the arguments persist across multiple ChromeOptions calls. Admittedly I havent used Python for long, but I do expect to see a new ChromeOptions object when I call the code, so clearly I am misunderstanding something fundamental here:

Code:

from selenium import webdriver
import os, os.path, sys

def test():
   
    # Global declaration
    #global driver
   
    # Fetching chrome options object
    options = webdriver.ChromeOptions()
   
    if options.arguments != []:

        print('Arguments persisted!')
        sys.exit(1)
   
    options.add_argument('--load-extension=Extensions\\adblock_plus_1_2')
   
    # Attempting to disable caching - using 0 does not work. Number is in bytes - technically you still get some sort of data cached in the user cache (currently
    # 'C:\Users\User\AppData\Local\Google\Chrome\User Data\Default\Cache'), but I think this is the best I can do 
    options.add_argument('--disk-cache-size=1')
    options.add_argument('--media-cache-size=1')
   
    # Chrome has a builtin flash player (to keep flash uptodate as it is so insecure) - disabling this appears to completely stop flash (i.e. it doesnt fall back to a plugin)
    options.add_argument('--disable-internal-flash')

    options.add_argument('--enable-logging')
    options.add_argument('--v=1')
   
    driver = webdriver.Chrome(executable_path="C:\\Users\\User\\Desktop\\Programs\\Chrome\\chromedriver_win_20.0.1133.0\\chromedriver.exe",
                              chrome_options=options)

test()
test()

Is anyone able to shed any light on this?

Thanks
Back to top
Permissions in this forum:
You cannot reply to topics in this forum