【发布时间】:2017-04-22 02:20:43
【问题描述】:
如何在没有在开发工具中手动启用的情况下,通过设备模式模拟(将鼠标事件模拟为触摸屏事件)运行 chrome?
最好带有标志更改或运行时参数更改。
【问题讨论】:
标签: google-chrome chromium touch-event device-emulation
如何在没有在开发工具中手动启用的情况下,通过设备模式模拟(将鼠标事件模拟为触摸屏事件)运行 chrome?
最好带有标志更改或运行时参数更改。
【问题讨论】:
标签: google-chrome chromium touch-event device-emulation
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "/Users/guolei/tmp/chromedriver");
Map<String, String> mobileEmulation = new HashMap<>();
mobileEmulation.put("deviceName", "iPhone 6");
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setExperimentalOption("mobileEmulation", mobileEmulation);
chromeOptions.addArguments("start-maximized");
WebDriver driver = new ChromeDriver(chromeOptions);
driver.get("http://m.taoche.com/");
}
【讨论】: