1、java:通过分辨率以及UA标识指定要模拟的手机
package bet;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import java.util.HashMap;
import java.util.Map;
public class test {
public static void main(String[] args) throws InterruptedException {
//配置参数
Map<String, Object> deviceMetrics = new HashMap<String, Object>();
//设置屏幕大小、像素
deviceMetrics.put("width", 480);
deviceMetrics.put("height", 720);
deviceMetrics.put("pixelRatio", 3.0);
Map<String, Object> mobileEmulation = new HashMap<String, Object>