What are the capabilities of the browser opened by

2019-09-08 09:02发布

I am curious to know the capabilities of the Chrome browser opened through the code:

driver=webdriver.chromedriver()

Is it same as that of incognito mode or is there a different kind?

2条回答
地球回转人心会变
2楼-- · 2019-09-08 09:06

Yes your are correct it just opens a chrome browser with no cache in it like incognito.

查看更多
男人必须洒脱
3楼-- · 2019-09-08 09:32

To extract the capabilities of the ChromeDriver / Chrome Browser you can use the capabilities property which returns a dictionary and you can use the following solution:

  • Code Block:

    from selenium import webdriver
    
    driver = webdriver.Chrome(executable_path="C:\\Utility\\BrowserDrivers\\chromedriver.exe")
    my_dict = driver.capabilities
    for key,val in my_dict.items():
        print (key, "=>", val)
    driver.quit()
    
  • Console Output:

    acceptInsecureCerts => False
    browserName => chrome
    browserVersion => 76.0.3809.100
    chrome => {'chromedriverVersion': '76.0.3809.68 (420c9498db8ce8fcd190a954d51297672c1515d5-refs/branch-heads/3809@{#864})', 'userDataDir': 'C:\\Users\\Debanjan.B\\AppData\\Local\\Temp\\scoped_dir3888_683123771'}
    goog:chromeOptions => {'debuggerAddress': 'localhost:26050'}
    networkConnectionEnabled => False
    pageLoadStrategy => normal
    platformName => windows nt
    proxy => {}
    setWindowRect => True
    strictFileInteractability => False
    timeouts => {'implicit': 0, 'pageLoad': 300000, 'script': 30000}
    unhandledPromptBehavior => dismiss and notify
    

You can find a relevant discussion in How to provide custom capabilities on the selenium server?

查看更多
登录 后发表回答