【问题标题】:What are the capabilities of the browser opened by selenium-webdriver?selenium-webdriver 打开的浏览器有哪些功能?
【发布时间】:2019-08-15 08:45:15
【问题描述】:
很想知道通过代码打开的Chrome浏览器的功能:
driver=webdriver.chromedriver()
和incognito模式是一样的还是有不同的?
【问题讨论】:
标签:
selenium
google-chrome
selenium-webdriver
webdriver
selenium-chromedriver
【解决方案1】:
要提取 ChromeDriver / Chrome 浏览器 的功能,您可以使用返回字典的 capabilities 属性,您可以使用以下解决方案:
-
代码块:
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()
-
控制台输出:
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
可以在How to provide custom capabilities on the selenium server?找到相关讨论