Selenium Operation Browser is not loaded any configuration, online search for half a day, about the Firefox load configuration multipoint, chrome data is very few, here is about loading Chrome configuration method:
First, load all chrome configurations
Use the Chrome address bar to enter chrome://version/, view your profile path, and then, when the browser starts, call this configuration file with the following code:
#coding =utf-8
From selenium import Webdriver
option = Webdriver. Chromeoptions ()
Option.add_argument ('--user-data-dir=c:\users\administrator\appdata\local\google\chrome\user data ') # Set as user's own data directory
Driver = Webdriver. Chrome (chrome_options=option)
Second, modify the browser's user-agent to disguise your browser to access the mobile m station
#coding =utf-8
From selenium import Webdriver
option = Webdriver. Chromeoptions ()
Option.add_argument ('--user-agent=iphone ')
Driver = Webdriver. Chrome (chrome_options=option)
Driver.get (' http://www.taobao.com/')
Third, install CRX extension when browser starts
#coding =utf-8
From selenium import Webdriver
option = Webdriver. Chromeoptions ()
Option.add_extension (' D:\crx\AdBlock_v2.17.crx ') #自己下载的crx路径
Driver = Webdriver. Chrome (chrome_options=option)
Driver.get (' http://www.taobao.com/')
You can go to https://sites.google.com/a/chromium.org/chromedriver/capabilities to see more, or go to http://stackoverflow.com/to find.
Webdriver loading a configuration when you start Chrome