def screenshot(self, save_path, element=None, delay=<NUM_LIT:0>):
if save_path is None:<EOL><INDENT>logger.error("<STR_LIT>")<EOL>return None<EOL><DEDENT>save_location = cutil.norm_path(save_path)<EOL>cutil.create_path(save_location)<EOL>logger.info("<STR_LIT>".format(filename=save_location))<EOL>if not self.driver_type.startswith('<STR_LIT>'):<EOL><INDENT>logger.debug("<STR_LIT>")<EOL>from web_wrapper import DriverSeleniumPhantomJS<EOL>headers = self.get_headers()  <EOL>proxy = self.get_proxy()  <EOL>screenshot_web = DriverSeleniumPhantomJS(headers=headers, proxy=proxy)<EOL>screenshot_web.get_site(self.url, page_format='<STR_LIT>')<EOL>screenshot_driver = screenshot_web.driver<EOL><DEDENT>else:<EOL><INDENT>screenshot_driver = self.driver<EOL><DEDENT>time.sleep(delay)<EOL>if self.driver_type == '<STR_LIT>':<EOL><INDENT>self.chrome_fullpage_screenshot(save_location, delay)<EOL><DEDENT>else:<EOL><INDENT>screenshot_driver.get_screenshot_as_file(save_location)<EOL><DEDENT>if not save_location.endswith('<STR_LIT>'):<EOL><INDENT>save_location += '<STR_LIT>'<EOL><DEDENT>if element is not None:<EOL><INDENT>logger.debug("<STR_LIT>")<EOL>el_location = element.location<EOL>el_size = element.size<EOL>try:<EOL><INDENT>cutil.crop_image(save_location,<EOL>output_file=save_location,<EOL>width=int(el_size['<STR_LIT:width>']),<EOL>height=int(el_size['<STR_LIT>']),<EOL>x=int(el_location['<STR_LIT:x>']),<EOL>y=int(el_location['<STR_LIT:y>']),<EOL>)<EOL><DEDENT>except Exception as e:<EOL><INDENT>raise e.with_traceback(sys.exc_info()[<NUM_LIT:2>])<EOL><DEDENT><DEDENT>if not self.driver_type.startswith('<STR_LIT>'):<EOL><INDENT>screenshot_web.quit()<EOL><DEDENT>return save_location<EOL>
This can be used no matter what driver that is being used
* ^ Soon requests support will be added

Save screenshot to local dir with uuid as filename
then move the file to `filename` (path must be part of the file name)

Return the filepath of the image