本文整理汇总了Java中ru.yandex.qatools.ashot.AShot类的典型用法代码示例。如果您正苦于以下问题:Java AShot类的具体用法?Java AShot怎么用?Java AShot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AShot类属于ru.yandex.qatools.ashot包,在下文中一共展示了AShot类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: saveFullPageScreenshot
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
@Attachment(value = "Entirepage Screenshot of {0}", type = "image/png")
public static byte[] saveFullPageScreenshot(String name,WebDriver driver)
{
try
{
BufferedImage image = new AShot().shootingStrategy(ShootingStrategies.viewportPasting(1000)).takeScreenshot(driver).getImage();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(image, "png", baos);
baos.flush();
byte[] imageInByte = baos.toByteArray();
baos.close();
return imageInByte;
}
catch (IOException e)
{
e.printStackTrace();
}
return "Unable to Get Screenshot.".getBytes();
}
开发者ID:GladsonAntony,项目名称:WebAutomation_AllureParallel,代码行数:20,代码来源:AllureAttachments.java
示例2: excludeAndInclude
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
@Deprecated
/**
* use {@link TeasyScreenshot#excludeAndInclude(List, List)}
*/
public Screenshot excludeAndInclude(List<By> excludeLocators, List<By> includeLocators) {
WebDriver driver = getWebDriver();
AShot aShot = new AShot();
if (isChrome()) {
hideScrollbar(driver);
makeViewPortShootingStrategy(aShot);
}
addIgnoredAreas(excludeLocators, driver, aShot);
addMonochromeIndentFilter(aShot);
Screenshot screenshot = aShot.takeScreenshot(driver, getIncludeElements(includeLocators, driver));
if (isChrome()) {
revealScrollbar(driver);
}
return screenshot;
}
开发者ID:WileyLabs,项目名称:teasy,代码行数:20,代码来源:OurScreenshot.java
示例3: exclude
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
@Deprecated
/**
* use {@link TeasyScreenshot#exclude(List)}
*/
public Screenshot exclude(List<By> excludeLocators) {
WebDriver driver = getWebDriver();
AShot aShot = new AShot();
if (isChrome()) {
hideScrollbar(driver);
makeViewPortShootingStrategy(aShot);
}
addIgnoredAreas(excludeLocators, driver, aShot);
Screenshot screenshot = aShot.takeScreenshot(driver);
if (isChrome()) {
revealScrollbar(driver);
}
return screenshot;
}
开发者ID:WileyLabs,项目名称:teasy,代码行数:19,代码来源:OurScreenshot.java
示例4: include
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
@Deprecated
/**
* use {@link TeasyScreenshot#include(List)}
*/
public Screenshot include(List<By> includeLocators) {
WebDriver driver = getWebDriver();
AShot aShot = new AShot();
if (isChrome()) {
hideScrollbar(driver);
makeViewPortShootingStrategy(aShot);
}
addMonochromeIndentFilter(aShot);
Screenshot screenshot = aShot.takeScreenshot(driver, getIncludeElements(includeLocators, driver));
if (isChrome()) {
revealScrollbar(driver);
}
return screenshot;
}
开发者ID:WileyLabs,项目名称:teasy,代码行数:19,代码来源:OurScreenshot.java
示例5: fullPage
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
@Deprecated
/**
* use {@link TeasyScreenshot#fullPage()}
*/
public Screenshot fullPage() {
WebDriver driver = getWebDriver();
AShot aShot = new AShot();
if (isChrome()) {
hideScrollbar(driver);
makeViewPortShootingStrategy(aShot);
}
Screenshot screenshot = aShot.takeScreenshot(driver);
if (isChrome()) {
revealScrollbar(driver);
}
return screenshot;
}
开发者ID:WileyLabs,项目名称:teasy,代码行数:18,代码来源:OurScreenshot.java
示例6: takeScreenshot
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
public void takeScreenshot(ScenarioExecutionContext scenarioContext, Action action){
WebDriver driver = scenarioContext.getDriver();
if(driver instanceof TakesScreenshot){
ScenarioExecutionContext scenarioRootContext = scenarioContext.getRoot();
BufferedImage screenshot = new AShot()
.shootingStrategy(getShootingStrategy(scenarioRootContext))
.takeScreenshot(driver).getImage();
String format = getScreenshotFormat(scenarioRootContext);
String targetFileName = getFileName(scenarioRootContext, action, format);
try {
ImageIO.write(screenshot, format, new File(targetFileName));
} catch (IOException e) {
throw new NonReadableFileException(targetFileName, e);
}
}
}
开发者ID:automate-website,项目名称:jwebrobot,代码行数:18,代码来源:Screenshooter.java
示例7: getScreenShot
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
@Attachment(value = "Page")
public byte[] getScreenShot()
{
ru.yandex.qatools.ashot.Screenshot s = new AShot().takeScreenshot(localDriver);
try
{
ByteArrayOutputStream stream = new ByteArrayOutputStream();
ImageIO.write(s.getImage(), "png", stream);
stream.flush();
byte[] image = stream.toByteArray();
stream.close();
return image;
}
catch (IOException e)
{
e.printStackTrace();
return null;
}
}
开发者ID:crazycabo,项目名称:testable-testsuite-ui,代码行数:21,代码来源:Screenshot.java
示例8: capture
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
@Override
public ICapturable capture(ScreenArea area)
{
try
{
switch (area)
{
case VISIBLE_SCREEN:
screenshot = new AShot().takeScreenshot(driver).getImage();
break;
case FULL_SCREEN:
screenshot = new AShot().shootingStrategy(ShootingStrategies.viewportPasting(100)).takeScreenshot(driver).getImage();
break;
}
}
catch (Exception e)
{
LOGGER.error("Unable to capture screenshot: " + e.getMessage());
}
return this;
}
开发者ID:qaprosoft,项目名称:carina,代码行数:23,代码来源:Screen.java
示例9: addIgnoredAreas
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
private void addIgnoredAreas(List<TeasyElement> excludeElements, AShot aShot) {
for (TeasyElement element : excludeElements) {
Point location = element.getLocation();
Dimension size = element.getSize();
aShot.addIgnoredArea(new Coords(location.getX(), location.getY(), size.getWidth(), size.getHeight()));
}
}
开发者ID:WileyLabs,项目名称:teasy,代码行数:8,代码来源:TeasyScreenshot.java
示例10: addIgnoredAreas
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
private void addIgnoredAreas(List<By> excludeLocators, WebDriver driver, AShot aShot) {
for (By excludeLocator : excludeLocators) {
for (WebElement excludeElement : driver.findElements(excludeLocator)) {
aShot.addIgnoredArea(new Coords(excludeElement.getLocation().getX(), excludeElement.getLocation().getY(),
excludeElement.getSize().getWidth(), excludeElement.getSize().getHeight()));
}
}
}
开发者ID:WileyLabs,项目名称:teasy,代码行数:9,代码来源:OurScreenshot.java
示例11: takeScreenshot
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
/**
* <p>
* Take the screenshot
* </p>
*
* @return
*/
private static String takeScreenshot() {
try {
// now copy the screenshot to desired location using copyFile
Path screenshotFolder;
screenshotFolder = Paths.get(System.getProperty("user.dir"), "output/screenshots");
if (Files.notExists(screenshotFolder))
Files.createDirectory(screenshotFolder);
String fileName = "Screenshot" + "_" + System.nanoTime();
Path screenshotPath = Paths.get(screenshotFolder.toString(), fileName + ".png");
Screenshot screenshot = new AShot()
.takeScreenshot(getDriver());
ImageIO.write(screenshot.getImage(), "PNG", new File(screenshotPath.toString()));
return screenshotPath.toString();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
开发者ID:hemano,项目名称:cucumber-framework-java,代码行数:34,代码来源:StartingSteps.java
示例12: getScreenShotFromAShot
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
private File getScreenShotFromAShot(WebDriver driver, ShootingStrategy strategy) throws IOException {
File file = File.createTempFile("screenshot", ".png");
Screenshot screenshot = new AShot().shootingStrategy(strategy)
.takeScreenshot(driver);
ImageIO.write(screenshot.getImage(), "png", file);
return file;
}
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:8,代码来源:SeleniumDriver.java
示例13: excludeAndInclude
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
public Screenshot excludeAndInclude(List<TeasyElement> excludeElements, List<TeasyElement> includeElements) {
AShot aShot = new AShotChromeDecorator();
addIgnoredAreas(excludeElements, aShot);
addMonochromeIndentFilter(aShot);
return aShot.takeScreenshot(driver, asWebElements(includeElements));
}
开发者ID:WileyLabs,项目名称:teasy,代码行数:7,代码来源:TeasyScreenshot.java
示例14: exclude
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
public Screenshot exclude(List<TeasyElement> elements) {
AShot aShot = new AShotChromeDecorator();
addIgnoredAreas(elements, aShot);
return aShot.takeScreenshot(driver);
}
开发者ID:WileyLabs,项目名称:teasy,代码行数:6,代码来源:TeasyScreenshot.java
示例15: include
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
public Screenshot include(List<TeasyElement> elements) {
AShot aShot = new AShotChromeDecorator();
addMonochromeIndentFilter(aShot);
return aShot.takeScreenshot(driver, asWebElements(elements));
}
开发者ID:WileyLabs,项目名称:teasy,代码行数:6,代码来源:TeasyScreenshot.java
示例16: fullPage
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
public Screenshot fullPage() {
AShot aShot = new AShotChromeDecorator();
return aShot.takeScreenshot(driver);
}
开发者ID:WileyLabs,项目名称:teasy,代码行数:5,代码来源:TeasyScreenshot.java
示例17: addMonochromeIndentFilter
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
private void addMonochromeIndentFilter(AShot aShot) {
aShot.imageCropper(new IndentCropper().addIndentFilter(monochrome()));
}
开发者ID:WileyLabs,项目名称:teasy,代码行数:4,代码来源:TeasyScreenshot.java
示例18: addMonochromeIndentFilter
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
private void addMonochromeIndentFilter(AShot aShot) {
aShot.imageCropper(new IndentCropper()
.addIndentFilter(monochrome()));
}
开发者ID:WileyLabs,项目名称:teasy,代码行数:5,代码来源:OurScreenshot.java
示例19: makeViewPortShootingStrategy
import ru.yandex.qatools.ashot.AShot; //导入依赖的package包/类
private void makeViewPortShootingStrategy(AShot aShot) {
aShot.shootingStrategy(ShootingStrategies.viewportPasting(100));
}
开发者ID:WileyLabs,项目名称:teasy,代码行数:4,代码来源:OurScreenshot.java
注:本文中的ru.yandex.qatools.ashot.AShot类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论