5,219
社区成员
发帖
与我相关
我的任务
分享
System.setProperty("webdriver.chrome.driver", "/Users/kenny/software/driver/chromedriver");
// 声明ChromeOptions,主要是给Chrome设置参数.
final ChromeOptions chromeOptions = new ChromeOptions();
// 设置user agent的参数为iPhone 6
chromeOptions.addArguments("--user-agent=Mozilla/5.0 (Linux; U; Android 8.1.0; zh-cn; BLA-AL00 Build/HUAWEIBLA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/8.9 Mobile Safari/537.36");
chromeOptions.addArguments("--no-sandbox");
driver = new ChromeDriver(chromeOptions);
driver.manage().window().setSize(new Dimension(W, H));
wait = new WebDriverWait(driver, WAIT_INTEVAL);