public void remove() { throw new EyesException("Remove is forbidden using the iterator!"); } };
/** * Sets the proxy settings to be used by the rest client. * @param proxySettings The proxy settings to be used by the rest client. * If {@code null} then no proxy is set. */ @SuppressWarnings("UnusedDeclaration") public void setProxyBase(ProxySettings proxySettings) { throw new EyesException( "Proxy not implemented in this version!"); // this.proxySettings = proxySettings; // // restClient = buildRestClient(timeout, proxySettings); // endPoint = restClient.resource(serverUrl); }
public static URI getDefaultServerUrl() { try { return new URI("https://eyesapi.applitools.com"); } catch (URISyntaxException ex) { throw new EyesException(ex.getMessage(), ex); } }
public static URI getDefaultServerUrl() { try { return new URI("https://eyessdk.applitools.com"); } catch (URISyntaxException ex) { throw new EyesException(ex.getMessage(), ex); } }
public static URI getDefaultServerUrl() { try { return new URI("https://eyesapi.applitools.com"); } catch (URISyntaxException ex) { throw new EyesException(ex.getMessage(), ex); } }
public static URI getDefaultServerUrl() { try { return new URI("https://eyesapi.applitools.com"); } catch (URISyntaxException ex) { throw new EyesException(ex.getMessage(), ex); } }
public static URI getDefaultServerUrl() { try { return new URI("https://eyesapi.applitools.com"); } catch (URISyntaxException ex) { throw new EyesException(ex.getMessage(), ex); } }
/** * @return The batch start date and time in ISO 8601 format. */ @SuppressWarnings("UnusedDeclaration") @JsonSerialize(using = Iso8610CalendarSerializer.class) public Calendar getStartedAt() { try { return GeneralUtils.fromISO8601DateTime(startedAt); } catch (ParseException ex) { throw new EyesException("Failed to parse batch start time", ex); } }
/** * @return The batch start date and time in ISO 8601 format. */ @SuppressWarnings("UnusedDeclaration") @JsonSerialize(using = Iso8610CalendarSerializer.class) public Calendar getStartedAt() { try { return GeneralUtils.fromISO8601DateTime(startedAt); } catch (ParseException ex) { throw new EyesException("Failed to parse batch start time", ex); } }
private static Location parseLocationString(Object position) { String[] xy = position.toString().split(";"); if (xy.length != 2) { throw new EyesException("Could not get scroll position!"); } float x = Float.parseFloat(xy[0]); float y = Float.parseFloat(xy[1]); return new Location((int)Math.ceil(x), (int)Math.ceil(y)); }
/** * @return The batch start date and time in ISO 8601 format. */ @SuppressWarnings("UnusedDeclaration") @JsonSerialize(using = Iso8610CalendarSerializer.class) public Calendar getStartedAt() { try { return GeneralUtils.fromISO8601DateTime(startedAt); } catch (ParseException ex) { throw new EyesException("Failed to parse batch start time", ex); } }
/** * Save image to local file system * @param image The image to save. * @param filename The path to save image */ public static void saveImage(BufferedImage image, String filename) { try { logger.verbose("Saving file: " + filename); File file = new File(filename); ImageIO.write(image, "png", file); } catch (IOException e) { throw new EyesException("Failed to save image", e); } }
/** * Open the log file for writing. */ public void open() { try { if (file != null) { //noinspection EmptyCatchBlock try { file.close(); } catch (Exception e) {} } file = new BufferedWriter(new FileWriter(new File(filename), append)); } catch (IOException e) { throw new EyesException("Failed to create log file!", e); } }
/** * Handle a message to be logged. * @param verbose Whether this message is flagged as verbose or not. * @param logString The string to log. */ public void onMessage(boolean verbose, String logString) { if (fileWriter != null && (!verbose || this.isVerbose)) { try { fileWriter.write(getFormattedTimeStamp() + " Eyes: " + logString); fileWriter.newLine(); fileWriter.flush(); } catch (IOException e) { throw new EyesException("Failed to write log to file!", e); } } }
/** * Handle a message to be logged. * @param verbose Whether this message is flagged as verbose or not. * @param logString The string to log. */ public void onMessage(boolean verbose, String logString) { if (file != null && (!verbose || this.isVerbose)) { String currentTime = GeneralUtils.toISO8601DateTime( Calendar.getInstance(TimeZone.getTimeZone("UTC"))); try { file.write(currentTime + " Eyes: " + logString); file.newLine(); file.flush(); } catch (IOException e) { throw new EyesException("Failed to write log to file!", e); } } }
/** * Scrolls to the specified location inside the element. * @param location The location to scroll to. */ public Location scrollTo(Location location) { Object position = eyesDriver.executeScript(String.format(JS_SCROLL_TO_FORMATTED_STR, location.getX(), location.getY()) + JS_GET_SCROLL_POSITION, this); String[] xy = position.toString().split(";"); if (xy.length != 2) { throw new EyesException("Could not get scroll position!"); } float x = Float.parseFloat(xy[0]); float y = Float.parseFloat(xy[1]); return new Location((int) Math.ceil(x), (int) Math.ceil(y)); }
/** * * @return The entire size of the container which the position is relative * to. */ public RectangleSize getEntireSize() { logger.verbose(String.format("enter (scrollRootElement: %s)", scrollRootElement)); String entireSizeStr = (String)executor.executeScript(JS_GET_ENTIRE_PAGE_SIZE, scrollRootElement); String[] wh = entireSizeStr.split(","); if (wh.length != 2) { throw new EyesException("Could not get entire size!"); } float w = Float.parseFloat(wh[0]); float h = Float.parseFloat(wh[1]); RectangleSize result = new RectangleSize((int)Math.ceil(w), (int)Math.ceil(h)); logger.verbose("ScrollPositionProvider - Entire size: " + result); return result; }
public WebElement findElement(By by) { WebElement webElement = driver.findElement(by); if (webElement instanceof RemoteWebElement) { webElement = new EyesRemoteWebElement(logger, this, webElement); // For Remote web elements, we can keep the IDs, // for Id based lookup (mainly used for Javascript related // activities). elementsIds.put(((RemoteWebElement) webElement).getId(), webElement); } else { throw new EyesException("findElement: Element is not a RemoteWebElement: " + by); } return webElement; }
private void initDriver(WebDriver driver) { if (driver instanceof RemoteWebDriver) { this.driver = new EyesWebDriver(logger, this, (RemoteWebDriver) driver); } else if (driver instanceof EyesWebDriver) { this.driver = (EyesWebDriver) driver; } else { String errMsg = "Driver is not a RemoteWebDriver (" + driver.getClass().getName() + ")"; logger.log(errMsg); throw new EyesException(errMsg); } if (EyesSeleniumUtils.isMobileDevice(driver)) { regionVisibilityStrategyHandler.set(new NopRegionVisibilityStrategy(logger)); } }
public WebElement activeElement() { logger.verbose("Switching to element..."); WebElement element = targetLocator.activeElement(); if (!(element instanceof RemoteWebElement)) { throw new EyesException("Not a remote web element!"); } EyesRemoteWebElement result = new EyesRemoteWebElement(logger, driver, element); logger.verbose("Done!"); return result; }