PtlWebElement extends RemoteWebElement { static double getDoubleOrDefault(Object object, double defaultValue) { if (object == null) { return defaultValue; } if (object instanceof Number) { return ((Number) object).doubleValue(); } Matcher matcher = PATTERN_NUMBER.matcher(object.toString()); if (!matcher.find()) { LOG.debug("Parse double failed. Not number: {}", object); return defaultValue; } try { return Double.parseDouble(matcher.group()); } catch (Exception e) { LOG.debug("Parse double failed: {}", object); return defaultValue; } } protected  PtlWebElement(); PtlWebElement getFrameParent(); void setFrameParent(PtlWebElement frameParent); @Override void setParent(RemoteWebDriver parent); @Override String getTagName(); @Override PtlWebDriver getWrappedDriver(); void executeInFrame(Runnable doInFrame); T executeInFrame(Supplier<T> doInFrame); void executeInFrame(WebElement frameElement, Runnable doInFrame); T executeInFrame(WebElement frameElement, Supplier<T> doInFrame); DoubleValueRect getDoubleValueRect(); WebElementMargin getMargin(); WebElementBorderWidth getBorderWidth(); WebElementPadding getPadding(); void hide(); void show(); boolean isVisibilityHidden(); int getScrollNum(); long getClientHeight(); long getClientWidth(); long getScrollHeight(); long getScrollWidth(); int scrollNext(); void scrollTo(double x, double y); void hideScrollBar(); void setNoResizable(); String[] getOverflowStatus(); void setOverflowStatus(String xStatus, String yStatus); String getResizeStatus(); void setResizeStatus(String status); boolean isBody(); boolean isFrame();  }
@Test public void testGetDoubleOrDefault() throws Exception { double value = PtlWebElement.getDoubleOrDefault(1d, Double.NaN); assertThat(value, is(1d)); }
@Test public void testGetDoubleOrDefault_mixed() throws Exception { double value = PtlWebElement.getDoubleOrDefault("1.0px", Double.NaN); assertThat(value, is(1d)); }
@Test public void testGetDoubleOrDefault_not_number() throws Exception { double value = PtlWebElement.getDoubleOrDefault("middle", Double.NaN); assertThat(value, is(Double.NaN)); }
@Test public void testGetDoubleOrDefault_minus_number() throws Exception { double value = PtlWebElement.getDoubleOrDefault("-1.5px", Double.NaN); assertThat(value, is(-1.5d)); }