func (p *Page) Screenshot(filename string) error {
	absFilePath, err := filepath.Abs(filename)
	if err != nil {
		return fmt.Errorf("failed to find absolute path for filename: %s", err)
	}

	screenshot, err := p.session.GetScreenshot()
	if err != nil {
		return fmt.Errorf("failed to retrieve screenshot: %s", err)
	}

	if err := ioutil.WriteFile(absFilePath, screenshot, 0666); err != nil {
		return fmt.Errorf("failed to save screenshot: %s", err)
	}

	return nil
}
func (p *Page) Screenshot(filename string) error {
	absFilePath, err := filepath.Abs(filename)
	if err != nil {
		return fmt.Errorf("failed to find absolute path for filename: %s", err)
	}

	screenshot, err := p.session.GetScreenshot()
	if err != nil {
		return fmt.Errorf("failed to retrieve screenshot: %s", err)
	}

	if err := ioutil.WriteFile(absFilePath, screenshot, 0666); err != nil {
		return fmt.Errorf("failed to save screenshot: %s", err)
	}

	return nil
}
func ( p * Page ) Screenshot ( filename string ) error { absFilePath , err := filepath . Abs ( filename ) if err != nil { return fmt . Errorf ( " " , err ) } screenshot , err := p . session . GetScreenshot ( ) if err != nil { return fmt . Errorf ( " " , err ) } if err := ioutil . WriteFile ( absFilePath , screenshot , 0666 ) ; err != nil { return fmt . Errorf ( " " , err ) } return nil }
// Screenshot takes a screenshot and saves it to the provided filename.
// The provided filename may be an absolute or relative path.
Screenshot takes a screenshot and saves it to the provided filename . The provided filename may be an absolute or relative path .