打开浏览器默认是M站模式代码

    public WebDriver selectExplorerByName() {
        System.setProperty(  
                "webdriver.chrome.driver",   
                "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chromedriver.exe");


          Map<String, Object> mobileEmulation = new HashMap<String, Object>();  
            mobileEmulation.put("deviceName", "Apple iPhone 6");                 
            Map<String, Object> chromeOptions = new HashMap<String, Object>();  
            chromeOptions.put("mobileEmulation", mobileEmulation);  
            DesiredCapabilities capabilities = DesiredCapabilities.chrome();  
            capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);  
                      
            return  new ChromeDriver(capabilities); 
        }
    }

posted @ 2017-06-15 14:27  "花田李氏  阅读(491)  评论(0)    收藏  举报