@JavascriptEnabled @Test @Ignore( value = {SAFARI, MARIONETTE}, reason = "Advanced mouse actions only implemented in rendered browsers", issues = {4136}) @NotYetImplemented(HTMLUNIT) @NoDriverAfterTest public void testCanMoveOverAndOutOfAnElement() { driver.get(pages.mouseOverPage); WebElement greenbox = driver.findElement(By.id("greenbox")); WebElement redbox = driver.findElement(By.id("redbox")); Dimension size = redbox.getSize(); new Actions(driver).moveToElement(greenbox, 1, 1).perform(); assertEquals( Colors.GREEN.getColorValue(), Color.fromString(redbox.getCssValue("background-color"))); new Actions(driver).moveToElement(redbox).perform(); assertEquals( Colors.RED.getColorValue(), Color.fromString(redbox.getCssValue("background-color"))); // IE8 (and *only* IE8) requires a move of 2 pixels. All other browsers // would be happy with 1. new Actions(driver).moveToElement(redbox, size.getWidth() + 2, size.getHeight() + 2).perform(); assertEquals( Colors.GREEN.getColorValue(), Color.fromString(redbox.getCssValue("background-color"))); }
public String getCssValue(String property) { assertElementNotStale(); String value = callMethod("return " + OperaAtom.GET_EFFECTIVE_STYLE + "(locator, '" + property + "')"); // WebDriver specifies that the output from getCssValue() must be in RGBA format if (property.contains("color") && value.contains("rgb")) { return Color.fromString(value).asRgba(); } return value; }
@JavascriptEnabled @Test @Ignore( value = {SAFARI, MARIONETTE}, reason = "Advanced mouse actions only implemented in rendered browsers", issues = {4136}) @NotYetImplemented(HTMLUNIT) // @NoDriverAfterTest public void testMoveMouseByOffsetOverAndOutOfAnElement() { driver.get(pages.mouseOverPage); WebElement greenbox = driver.findElement(By.id("greenbox")); WebElement redbox = driver.findElement(By.id("redbox")); Dimension size = redbox.getSize(); Point greenboxPosition = greenbox.getLocation(); Point redboxPosition = redbox.getLocation(); int shiftX = redboxPosition.getX() - greenboxPosition.getX(); int shiftY = redboxPosition.getY() - greenboxPosition.getY(); new Actions(driver).moveToElement(greenbox, 2, 2).perform(); assertEquals( Colors.GREEN.getColorValue(), Color.fromString(redbox.getCssValue("background-color"))); new Actions(driver).moveToElement(greenbox, 2, 2).moveByOffset(shiftX, shiftY).perform(); assertEquals( Colors.RED.getColorValue(), Color.fromString(redbox.getCssValue("background-color"))); new Actions(driver) .moveToElement(greenbox, 2, 2) .moveByOffset(shiftX, shiftY) .moveByOffset(-shiftX, -shiftY) .perform(); assertEquals( Colors.GREEN.getColorValue(), Color.fromString(redbox.getCssValue("background-color"))); }
@Override public BaseConfiguration setMarkingsColorUsedOutline(Color color) { return setProperty(key(NamedProperties.MARKINGS_COLOR_USED_OUTLINE), color.toString()); }
@Override public Color getMarkingsColorUsedOutline() { return Color.fromString( getStringProperty(key(NamedProperties.MARKINGS_COLOR_USED_OUTLINE), "#008000")); }
@Override public BaseConfiguration setMarkingsColorUsedBackground(Color color) { return setProperty(key(NamedProperties.MARKINGS_COLOR_USED_BACKGROUND), color.toString()); }
@Override public Color getMarkingsColorUsedBackground() { return Color.fromString( getStringProperty(key(NamedProperties.MARKINGS_COLOR_USED_BACKGROUND), "#90ee90")); }