我使用Selenium Webdriver
,我想在执行测试之前清除 cookie。我使用来自官方“Selenium”网站的代码。这是代码:
Cookie cookie = new Cookie("key", "value");
driver.manage().addCookie(cookie);
Set<Cookie> allCookies = driver.manage().getCookies();
for (Cookie loadedCookie : allCookies) {
System.out.println(String.format("%s -> %s", loadedCookie.getName(), loadedCookie.getValue()));
}
driver.manage().deleteAllCookies();
但我收到通知:- Cookie cannot be resolved to a type, Set cannot be resolved to a type