Тип driver.manage().logs().get(LogType.BROWSER)
- LogEntries
, а не String
.
String
, сделайте следующее: public String getConsoleLogs(WebDriver driver) {
LogEntries logEntries = driver.manage().logs().get(LogType.BROWSER);
String consoleLog = "";
for (LogEntry logEntry : logEntries.getAll()) {
consoleLog += logEntry.toString() + "\n";
}
return consoleLog;
}
File
, сделайте это: public static File writeLogEntriesInATextFile(WebDriver driver, String name) throws IOException {
LogEntries logEntries = driver.manage().logs().get(LogType.BROWSER);
File consoleLog = File.createTempFile(name, "txt");
FileWriter output = new FileWriter(consoleLog);
for (LogEntry logEntry : logEntries.getAll()) {
output.write(logEntry.toString() + "\n");
}
output.close();
return consoleLog;
}
Имейте в виду, что это не работает в FireFox < 65
.
Это должно сделать это:
var bitmapFrame = BitmapFrame.Create(new Uri(@"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg"), BitmapCreateOptions.DelayCreation, BitmapCacheOption.None);
var width = bitmapFrame.PixelWidth;
var height = bitmapFrame.PixelHeight;