All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.slickqa.webdriver.RemoteDriverWithScreenshots Maven / Gradle / Ivy

There is a newer version: 1.0.1-37
Show newest version
package com.slickqa.webdriver;

import org.openqa.selenium.Capabilities;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.remote.DriverCommand;
import org.openqa.selenium.remote.RemoteWebDriver;

import java.net.MalformedURLException;
import java.net.URL;

/**
 *
 * @author jcorbett
 */
public class RemoteDriverWithScreenshots extends RemoteWebDriver implements TakesScreenshot
{
	public static String REMOTE_URL = "remote.url";

	public RemoteDriverWithScreenshots(URL url, Capabilities capabilities)
	{
		super(url, capabilities);
	}

	public RemoteDriverWithScreenshots(Capabilities capabilities) throws MalformedURLException
	{
		super(new URL((String)capabilities.getCapability(REMOTE_URL)), capabilities);
	}

	@Override
	public  X getScreenshotAs(OutputType ot) throws WebDriverException
	{
		String base64 = execute(DriverCommand.SCREENSHOT).getValue().toString();
    	return ot.convertFromBase64Png(base64);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy