如何使用设备模式模拟(将鼠标事件作为触摸屏事件)运行铬
最好使用标志更改或运行时间参数更改。
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/");
}