类org.openqa.selenium.remote.Augmenter源码实例Demo

下面列出了怎么用org.openqa.selenium.remote.Augmenter的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: LuckyFrameClient   文件: BaseWebDrive.java
/**
 * �����Խ�����н�ͼ
 * @param driver ����
 * @param imgname ͼƬ����
 */
public static void webScreenShot(WebDriver driver, String imgname) {
	String relativelyPath = System.getProperty("user.dir");
	String pngpath=relativelyPath +File.separator+ "log"+File.separator+"ScreenShot" +File.separator+ imgname + ".png";

	// ��Զ��ϵͳ���н�ͼ
	driver = new Augmenter().augment(driver);
	File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
	try {
		FileUtils.copyFile(scrFile, new File(pngpath));
	} catch (IOException e) {
		LogUtil.APP.error("��ͼ����ʧ�ܣ��׳��쳣��鿴��־...", e);
	}
	scrFile.deleteOnExit();
	LogUtil.APP
			.info("�ѶԵ�ǰ������н�ͼ��������ͨ������ִ�н������־��ϸ�鿴��Ҳ����ǰ���ͻ����ϲ鿴...��{}��",pngpath);
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void testFailure(Failure failure) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failure.getDescription().getMethodName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot...");
        ex.printStackTrace();
    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());

    }
}
 
@Override
public void onTestFailure(ITestResult failingTest) {
    try {
        WebDriver driver = getDriver();
        String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots");
        String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png";
        File screenshot = new File(screenshotAbsolutePath);
        if (createFile(screenshot)) {
            try {
                writeScreenshotToFile(driver, screenshot);
            } catch (ClassCastException weNeedToAugmentOurDriverObject) {
                writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
            }
            System.out.println("Written screenshot to " + screenshotAbsolutePath);
        } else {
            System.err.println("Unable to create " + screenshotAbsolutePath);
        }
    } catch (Exception ex) {
        System.err.println("Unable to capture screenshot: " + ex.getCause());
    }
}
 
源代码22 项目: hsac-fitnesse-fixtures   文件: SeleniumHelper.java
/**
 * Takes screenshot of current page (as .png).
 * @param baseName name for file created (without extension),
 *                 if a file already exists with the supplied name an
 *                 '_index' will be added.
 * @return absolute path of file created.
 */
public String takeScreenshot(String baseName) {
    String result = null;

    WebDriver d = driver();

    if (!(d instanceof TakesScreenshot)) {
        d = new Augmenter().augment(d);
    }
    if (d instanceof TakesScreenshot) {
        TakesScreenshot ts = (TakesScreenshot) d;
        byte[] png = ts.getScreenshotAs(OutputType.BYTES);
        result = writeScreenshot(baseName, png);
    }
    return result;
}
 
源代码23 项目: selenium   文件: RemoteSession.java
protected RemoteSession(
    Dialect downstream,
    Dialect upstream,
    HttpHandler codec,
    SessionId id,
    Map<String, Object> capabilities) {
  this.downstream = Require.nonNull("Downstream dialect", downstream);
  this.upstream = Require.nonNull("Upstream dialect", upstream);
  this.codec = Require.nonNull("Codec", codec);
  this.id = Require.nonNull("Session id", id);
  this.capabilities = Require.nonNull("Capabilities", capabilities);

  File tempRoot = new File(StandardSystemProperty.JAVA_IO_TMPDIR.value(), id.toString());
  Require.stateCondition(tempRoot.mkdirs(), "Could not create directory %s", tempRoot);
  this.filesystem = TemporaryFilesystem.getTmpFsBasedOn(tempRoot);

  CommandExecutor executor = new ActiveSessionCommandExecutor(this);
  this.driver = new Augmenter().augment(new RemoteWebDriver(
      executor,
      new ImmutableCapabilities(getCapabilities())));
}
 
源代码24 项目: healenium-web   文件: HealingServiceImpl.java
/**
 * Create screenshot of healed element
 * @param byScored - healed locator
 * @return path to screenshot location
 */
//TODO: need pass search context here
private byte[] captureScreen(Scored<By> byScored) {
    WebElement element = driver.findElement(byScored.getValue());
    JavascriptExecutor jse = (JavascriptExecutor) driver;
    jse.executeScript("arguments[0].style.border='3px solid red'", element);
    WebDriver augmentedDriver = new Augmenter().augment(driver);
    return ((TakesScreenshot) augmentedDriver).getScreenshotAs(OutputType.BYTES);
}
 
public static void takeScreenshot(WebDriver driver, String filename) {
    String screenshotDirectory = System.getProperty("screenshotDirectory", "build/screenshots");
    String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + filename + ".png";
    File screenshot = new File(screenshotAbsolutePath);
    if (createFile(screenshot)) {
        try {
            writeScreenshotToFile(driver, screenshot);
        } catch (ClassCastException weNeedToAugmentOurDriverObject) {
            writeScreenshotToFile(new Augmenter().augment(driver), screenshot);
        }
        System.out.println("Written screenshot to " + screenshotAbsolutePath);
    } else {
        System.err.println("Unable to create " + screenshotAbsolutePath);
    }
}
 
源代码26 项目: teasy   文件: BaseTeasyElement.java
@Override
public <X> X getScreenshotAs(OutputType<X> target) {
    if (getDriver().getClass() == RemoteWebDriver.class) {
        WebDriver augmentedDriver = new Augmenter().augment(getDriver());
        return ((TakesScreenshot) augmentedDriver).getScreenshotAs(target);
    } else {
        return ((TakesScreenshot) getDriver()).getScreenshotAs(target);
    }
}
 
源代码27 项目: teasy   文件: WebDriverDecorator.java
@Override
public <X> X getScreenshotAs(final OutputType<X> target) throws WebDriverException {
    if (driver.getClass() == RemoteWebDriver.class) {
        WebDriver augmentedDriver = new Augmenter().augment(driver);
        return ((TakesScreenshot) augmentedDriver).getScreenshotAs(target);
    } else {
        return ((TakesScreenshot) driver).getScreenshotAs(target);
    }
}
 
源代码28 项目: mamute   文件: FailFastListener.java
private void takeScreenshot(File tempDir) throws IOException {
	try {
		driver = new Augmenter().augment(driver);
        File srcFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
		File png = new File(tempDir, "failure" + System.currentTimeMillis() + ".png");
		FileUtils.copyFile(srcFile, png);
		System.err.println("screenshot saved to " + png.getAbsolutePath());
	} catch (Exception e) {
		System.err.println("could not save screen shot, see exception below");
		e.printStackTrace();
	}
}
 
源代码29 项目: JTAF-ExtWebDriver   文件: ScreenshotUtils.java
/***
 * Take a screenshot of the browser content. Note that while using RemoteWebDriver sessions (ie: with
 * Sauce Labs), the screenshot will be a full page of content--not only the visible content where the
 * page is scrolled (as when using a non-RemoteWebDriver session).
 * 
 * @param toSaveAs - name of the file to save the picture in (Note: must be PNG)
 * @throws IOException 
 */
public static void takeScreenshotOfPage(File toSaveAs) throws IOException {
	WebDriver wd = SessionManager.getInstance().getCurrentSession().getWrappedDriver();
	File screenshot;
	if(!(wd instanceof RemoteWebDriver)) {
		screenshot = ((TakesScreenshot) wd).getScreenshotAs(OutputType.FILE);		
	}
	else {
		Augmenter augmenter = new Augmenter();
		screenshot = ((TakesScreenshot) augmenter.augment(wd)).getScreenshotAs(OutputType.FILE);
	}
	FileUtils.copyFile(screenshot, toSaveAs);
}
 
public SeleniumScreenshotRule(WebDriver driver) {
  if (driver instanceof RemoteWebDriver) {
    webDriver = new Augmenter().augment(driver);
  } else {
    webDriver = driver;
  }
}
 
 类所在包
 同包方法