Take screenshot of the current window.

@param target The target type/format of the Screenshot
@return Screenshot of current window, in the requested format
338964
@Override
    public <X> X getScreenshotAs(OutputType<X> target) {
        // Get the screenshot as base64 and convert it to the requested type (i.e. OutputType<T>)
        String base64 = (String) execute(DriverCommand.SCREENSHOT).getValue();
        return target.convertFromBase64Png(base64);
    }
669132
def screenshot(self, filename=None):
        
        # screen size: 1280x720
        screen = self._ymc.screenshot()
        if filename:
            screen.save(filename)
        return screen
832133
def screenshot(context):
    
    handler = lambda _, buff, file_handler: file_handler.write(buff)

    string = BytesIO()
    stream = context.domain.connect().newStream(0)
    context.domain.screenshot(stream, 0, 0)
    stream.recvAll(handler, string)

    return string.getvalue()
1000557
@SuppressWarnings("unchecked")
	public static <T> T get(Object target) {
		return (T) new RandomStructBehavior(target).doDetect();
	}
904251
private View getScreenshotView() {
		View decorView = viewFetcher.getRecentDecorView(viewFetcher.getWindowDecorViews());
		final long endTime = SystemClock.uptimeMillis() + Timeout.getSmallTimeout();

		while (decorView == null) {	

			final boolean timedOut = SystemClock.uptimeMillis() > endTime;

			if (timedOut){
				return null;
			}
			sleeper.sleepMini();
			decorView = viewFetcher.getRecentDecorView(viewFetcher.getWindowDecorViews());
		}
		wrapAllGLViews(decorView);

		return decorView;
	}
203315
def screenshot_to_file(self, filename, includes='subtitles'):
        """"""
        self.command('screenshot_to_file', filename.encode(fs_enc), includes)
1334487
function takeScreenshot (name) {
  if(_disabled) {
    return q.resolve();
  }

  return browser.driver.controlFlow().execute(function () {

    return q.all([_getProperties(browser), _getMetaData(browser), browser.takeScreenshot(), _readRunIdFile()]).then(function (results) {
      var properties = results[0],
        metaData = results[1],
        compareSettings = _compareSettingsFn,
        png = results[2],
        run = results[3];

      if (!run || !run.run_id) {
        _throwError('VisualReview-protractor: Could not send screenshot to VisualReview server, could not find any run ID. Was initRun called before starting this test? See VisualReview-protractor\'s documentation for more details on how to set this up.');
      }

      return _client.sendScreenshot(name, run.run_id, metaData, properties, compareSettings, png)
        .catch(function (err) {
          _throwError('Something went wrong while sending a screenshot to the VisualReview server. ' + err);
        });
    });
  }.bind(this));
}
1248829
public BufferedImage takeScreenshotEntirePage() {
        if (driver instanceof EventFiringWebDriver) {
            driver = ((EventFiringWebDriver) this.driver).getWrappedDriver();
        }

        if (driver instanceof ChromeDriver) {
            return takeScreenshotEntirePageUsingChromeCommand();
        } else if (driver instanceof RemoteWebDriver) {
            if (((RemoteWebDriver) driver).getCapabilities().getBrowserName().equals("chrome")) {
                return takeScreenshotEntirePageUsingChromeCommand();
            }
        }
        return takeScreenshotEntirePageDefault();
    }
144717
@Override
    public DataByteOutput<T> target(final T target) {
        return (DataByteOutput<T>) super.target(target);
    }
467256
static Map<View, FormValidator.FieldInfo> getFieldsForTarget(Object target) {
		Map<View, FormValidator.FieldInfo> infoMap = sCachedFieldsByTarget.get(target);

		if (infoMap != null) {
			for (View view : infoMap.keySet()) {
				// view has been removed from the window - we will need to scan fields of target again
				if (view.getWindowToken() == null) {
					infoMap = null;

					break;
				}
			}
		}

		if (infoMap == null) {
			infoMap = findFieldsToValidate(target);
			sCachedFieldsByTarget.put(target, infoMap);
		}
		return infoMap;
	}
329922
public Object get(Object target) {
        try {
            return  member.getEvenIfPrivate(target);
        } catch (JaversException e) {
            if (e.getCode() == JaversExceptionCode.MISSING_PROPERTY) {
                return null;
            }
            throw e;
        }
    }
470355
def screenshot(self, *args):
        """"""
        from mss import mss
        if not os.path.exists("screenshots"):
            os.makedirs("screenshots")
        box = {
            "top": self.winfo_y(),
            "left": self.winfo_x(),
            "width": self.winfo_width(),
            "height": self.winfo_height()
        }
        screenshot = mss().grab(box)
        screenshot = Image.frombytes("RGB", screenshot.size, screenshot.rgb)
        screenshot.save("screenshots/{}.png".format(ttk.Style(self).theme_use()))
1425
public boolean requireScreenshot(final ExtendedSeleniumCommand command,
			boolean result) {
		return
			(!command.isAssertCommand()
				&& !command.isVerifyCommand()
				&& !command.isWaitForCommand()
				&& screenshotPolicy == ScreenshotPolicy.STEP)
			|| (!result
				&& (screenshotPolicy == ScreenshotPolicy.FAILURE
					|| (command.isAssertCommand() && screenshotPolicy == ScreenshotPolicy.ASSERTION)));
	}
1009158
def screenshot(filename="screenshot.png"):
    
    if not settings.plotter_instance.window:
        colors.printc('~bomb screenshot(): Rendering window is not present, skip.', c=1)
        return
    w2if = vtk.vtkWindowToImageFilter()
    w2if.ShouldRerenderOff()
    w2if.SetInput(settings.plotter_instance.window)
    w2if.ReadFrontBufferOff()  # read from the back buffer
    w2if.Update()
    pngwriter = vtk.vtkPNGWriter()
    pngwriter.SetFileName(filename)
    pngwriter.SetInputConnection(w2if.GetOutputPort())
    pngwriter.Write()
1259209
public static String capitalize(final Object target) {

        if (target == null) {
            return null;
        }
        final StringBuilder result = new StringBuilder(target.toString());
        if (result.length() > 0) {
            result.setCharAt(0, Character.toTitleCase(result.charAt(0)));
        }
        return result.toString();

    }
754757
def take_screenshot(self):
    """"""

    if not self.failed:
        return

    browser = getattr(world, 'browser', None)
    if not browser:
        return

    try:
        scenario_name = self.scenario.name
        scenario_index = \
            self.scenario.feature.scenarios.index(self.scenario) + 1
    except AttributeError:
        scenario_name = self.background.keyword
        scenario_index = 0

    if self.outline is None:
        outline_index_str = ''
    else:
        outline_index = self.scenario.outlines.index(self.outline) + 1
        outline_index_str = '_{}'.format(outline_index)

    base_name = FORMAT.format(
        feature_file=os.path.relpath(self.feature.filename),
        scenario_index=scenario_index,
        scenario_name=scenario_name,
        outline_index=outline_index_str,
    )
    base_name = re.sub(r'\W', '_', base_name, flags=re.UNICODE)
    base_name = os.path.join(DIRECTORY, base_name)

    world.browser.save_screenshot('{}.png'.format(base_name))

    with open('{}.html'.format(base_name), 'w') as page_source_file:
        page_source_file.write(world.browser.page_source)
73021
protected void get_subwindow( T image , GrayF64 output ) {

		// copy the target region

		interp.setImage(image);
		int index = 0;
		for( int y = 0; y < workRegionSize; y++ ) {
			float yy = regionTrack.y0 + y*stepY;

			for( int x = 0; x < workRegionSize; x++ ) {
				float xx = regionTrack.x0 + x*stepX;

				if( interp.isInFastBounds(xx,yy))
					output.data[index++] = interp.get_fast(xx,yy);
				else if( BoofMiscOps.checkInside(image, xx, yy))
					output.data[index++] = interp.get(xx, yy);
				else {
					// randomize to make pixels outside the image poorly correlate.  It will then focus on matching
					// what's inside the image since it has structure
					output.data[index++] = rand.nextFloat()*maxPixelValue;
				}
			}
		}

		// normalize values to be from -0.5 to 0.5
		PixelMath.divide(output, maxPixelValue, output);
		PixelMath.plus(output, -0.5f, output);
		// apply the cosine window to it
		PixelMath.multiply(output,cosine,output);
	}