您好,我正在尝试使用相同的代码从 Chrome 和 Edge 检索性能日志以扫描错误,但是对于边缘,我得到 org.openqa.selenium.InvalidArgumentException: invalid argument: log type 'performance' not found (Session info: MicrosoftEdge=96.0.1054.34)
case "EDGE":
System.out.println("Launching Edge Browser");
HashMap<String, Object> EdgePrefs = new HashMap<String, Object>();
EdgePrefs.put("profile.default_content_settings.popups", 0);
EdgePrefs.put("download.default_directory", downloadPath);
EdgeOptions Edgeoptions = new EdgeOptions();
Edgeoptions.setCapability("prefs", EdgePrefs);
Edgeoptions.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
LoggingPreferences EdgelogPrefs = new LoggingPreferences();
EdgelogPrefs.enable(LogType.PERFORMANCE, Level.ALL);
EdgelogPrefs.enable(LogType.DRIVER, Level.ALL);
EdgelogPrefs.enable(LogType.BROWSER, Level.ALL);
Edgeoptions.setCapability("enableNetwork",true);
Edgeoptions.setCapability(CapabilityType.LOGGING_PREFS, EdgelogPrefs);
Edgeoptions.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS,true);
WebDriverManager.edgedriver().setup();
driver = new EdgeDriver(Edgeoptions);
driver.manage().timeouts().implicitlyWait(TimeOut,TimeUnit.SECONDS);
driver.manage().window().maximize();
break;
检索性能日志的代码
LogEntries logs = WD.manage().logs().get("performance");
这行代码导致 org.openqa.selenium.InvalidArgumentException: invalid argument: log type 'performance' not found (Session info: MicrosoftEdge=96.0.1054.34)