Selenium启动加载用户配置的浏览器(Chrome/Firefox)

来源:互联网 发布:怎么注册多个淘宝号 编辑:程序博客网 时间:2024/05/22 15:13

加载chrome用户配置

    ChromeOptions options = new ChromeOptions();    options.addArguments("user-data-dir=C:\\Users\\test\\AppData\\Local\\Google\\Chrome\\User Data\\Default");    WebDriever driver = new ChromeDriver(options );

加载firefox用户配置

    ProfilesIni allProfiles = new ProfilesIni();    FirefoxProfile profile = allProfiles.getProfile("default"); //default为火狐默认    WebDriever driver  = new FirefoxDriver(profile);
原创粉丝点击