/** * Downloads the log file for a Sauce Job and returns it. * * @param jobId the Sauce Job Id, typically equal to the Selenium/WebDriver sessionId * @return a BufferedInputStream containing the logfile * @throws IOException if there is a problem fetching the file */ public BufferedInputStream downloadLog(String jobId) throws IOException { URL restEndpoint = this.buildURL("v1/" + username + "/jobs/" + jobId + "/assets/selenium-server.log"); return downloadFileData(jobId, restEndpoint); }
/** * Downloads the log file for a Sauce Job and returns it. * * @param jobId the Sauce Job Id, typically equal to the Selenium/WebDriver sessionId * @return a BufferedInputStream containing the logfile * @throws IOException if there is a problem fetching the file */ public BufferedInputStream downloadLog(String jobId) throws IOException { URL restEndpoint = this.buildURL("v1/" + username + "/jobs/" + jobId + "/assets/selenium-server.log"); return downloadFileData(jobId, restEndpoint); }
/** * Downloads the video for a Sauce Job and returns it. * * Will probably eat your memory. * * @param jobId the Sauce Job Id, typically equal to the Selenium/WebDriver sessionId * @return A BufferedInputStream containing the video info * @throws IOException if there is a problem fetching the datt */ public BufferedInputStream downloadVideo(String jobId) throws IOException{ URL restEndpoint = this.buildURL("v1/" + username + "/jobs/" + jobId + "/assets/video.mp4"); return downloadFileData(jobId, restEndpoint); }
/** * Downloads the video for a Sauce Job and returns it. * * Will probably eat your memory. * * @param jobId the Sauce Job Id, typically equal to the Selenium/WebDriver sessionId * @return A BufferedInputStream containing the video info * @throws IOException if there is a problem fetching the datt */ public BufferedInputStream downloadVideo(String jobId) throws IOException{ URL restEndpoint = this.buildURL("v1/" + username + "/jobs/" + jobId + "/assets/video.mp4"); return downloadFileData(jobId, restEndpoint); }
/** * Downloads the HAR file for a Sauce Job. * * This will only work for jobs which support Extended Debugging, which were * started with the 'extendedDebugging' capability set to true. * * @param jobId the Sauce Job Id, typically equal to the Selenium/WebDriver sessionId * @return A BufferedInputStream containing the HAR data, unparsed * @throws IOException if there is a problem fetching the HAR file */ public BufferedInputStream getHARDataStream(String jobId) throws IOException { logger.log(Level.FINEST, "getHARDataStream for " + jobId); URL restEndpoint = this.buildURL("v1/" + username + "/jobs/" + jobId + "/assets/network.har"); return downloadFileData(jobId, restEndpoint); }
/** * Downloads the HAR file for a Sauce Job. * * This will only work for jobs which support Extended Debugging, which were * started with the 'extendedDebugging' capability set to true. * * @param jobId the Sauce Job Id, typically equal to the Selenium/WebDriver sessionId * @return A BufferedInputStream containing the HAR data, unparsed * @throws IOException if there is a problem fetching the HAR file */ public BufferedInputStream getHARDataStream(String jobId) throws IOException { logger.log(Level.FINEST, "getHARDataStream for " + jobId); URL restEndpoint = this.buildURL("v1/" + username + "/jobs/" + jobId + "/assets/network.har"); return downloadFileData(jobId, restEndpoint); }
/** * Downloads the HAR file for a Sauce Job, and returns it wrapped in a JSONTokener. * * Pass this JSONTokener to a JSONObject when you wish to read JSON. The * stream will be read as soon as a JSONObject is created. * * This will only work for jobs which support Extended Debugging, which were * started with the 'extendedDebugging' capability set to true. * * @param jobId the Sauce Job Id, typically equal to the Selenium/WebDriver sessionId * @return A JSONTokener containing the HAR data, tokenized * @throws IOException if there is a problem fetching the HAR file * @throws JSONException if encoding can't be determined or there's an IO problem */ public JSONTokener getHARData(String jobId) throws IOException, JSONException { logger.log(Level.FINEST, "getHARData for " + jobId); URL restEndpoint = this.buildURL("v1/" + username + "/jobs/" + jobId + "/assets/network.har"); BufferedInputStream har_stream = downloadFileData(jobId, restEndpoint); return new JSONTokener(har_stream); }
/** * Downloads the HAR file for a Sauce Job, and returns it wrapped in a JSONTokener. * * Pass this JSONTokener to a JSONObject when you wish to read JSON. The * stream will be read as soon as a JSONObject is created. * * This will only work for jobs which support Extended Debugging, which were * started with the 'extendedDebugging' capability set to true. * * @param jobId the Sauce Job Id, typically equal to the Selenium/WebDriver sessionId * @return A JSONTokener containing the HAR data, tokenized * @throws IOException if there is a problem fetching the HAR file * @throws JSONException if encoding can't be determined or there's an IO problem */ public JSONTokener getHARData(String jobId) throws IOException, JSONException { logger.log(Level.FINEST, "getHARData for " + jobId); URL restEndpoint = this.buildURL("v1/" + username + "/jobs/" + jobId + "/assets/network.har"); BufferedInputStream har_stream = downloadFileData(jobId, restEndpoint); return new JSONTokener(har_stream); }
BufferedInputStream in = downloadFileData(jobId, restEndpoint); SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT); String saveName = jobId + format.format(new Date());
BufferedInputStream in = downloadFileData(jobId, restEndpoint); SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT); String saveName = jobId + format.format(new Date());