本文整理匯總了Java中org.openqa.selenium.OutputType.convertFromBase64Png方法的典型用法代碼示例。如果您正苦於以下問題:Java OutputType.convertFromBase64Png方法的具體用法?Java OutputType.convertFromBase64Png怎麽用?Java OutputType.convertFromBase64Png使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openqa.selenium.OutputType
的用法示例。
在下文中一共展示了OutputType.convertFromBase64Png方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getScreenshotAs
import org.openqa.selenium.OutputType; //導入方法依賴的package包/類
@Override
public <X> X getScreenshotAs(OutputType<X> target) throws WebDriverException {
Object takeScreenshot =
getCapabilities().getCapability(CapabilityType.TAKES_SCREENSHOT);
if (null == takeScreenshot || (Boolean) takeScreenshot) {
String base64Str = execute(DriverCommand.SCREENSHOT).getValue().toString();
return target.convertFromBase64Png(base64Str);
}
return null;
}
示例2: extractScreenShot
import org.openqa.selenium.OutputType; //導入方法依賴的package包/類
public <T> T extractScreenShot(WebDriverException e, OutputType<T> target) {
if (e.getCause() instanceof ScreenshotException) {
String base64Str = ((ScreenshotException) e.getCause()).getBase64EncodedScreenshot();
return target.convertFromBase64Png(base64Str);
}
return null;
}
示例3: getScreenshotAs
import org.openqa.selenium.OutputType; //導入方法依賴的package包/類
public <X> X getScreenshotAs(final OutputType<X> target) throws WebDriverException {
if ((Boolean) getCapabilities().getCapability(CapabilityType.TAKES_SCREENSHOT)) {
String output = execute(DriverCommand.SCREENSHOT).getValue().toString();
return target.convertFromBase64Png(output);
}
return null;
}
示例4: getScreenshotAs
import org.openqa.selenium.OutputType; //導入方法依賴的package包/類
@Override
public <X> X getScreenshotAs(OutputType<X> target) throws WebDriverException {
try {
if ((Boolean) getCapabilities().getCapability(CapabilityType.TAKES_SCREENSHOT)) {
String base64Str = execute(DriverCommand.SCREENSHOT).getValue().toString();
return target.convertFromBase64Png(base64Str);
}
return null;
} catch (Exception e) {
return null;
}
}
示例5: getScreenshotAs
import org.openqa.selenium.OutputType; //導入方法依賴的package包/類
@Override public <X> X getScreenshotAs(OutputType<X> target) throws WebDriverException {
// Get the screenshot as base64.
String base64 = (String) execute(DriverCommand.SCREENSHOT).getValue();
// ... and convert it.
return target.convertFromBase64Png(base64);
}