Java Code Examples for org.openqa.selenium.support.Color#fromString()

The following examples show how to use org.openqa.selenium.support.Color#fromString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CssValueTest.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Test
public void testShouldPickUpStyleOfAnElement() {
  driver.get(pages.javascriptPage);

  WebElement element = driver.findElement(By.id("green-parent"));
  Color backgroundColour = Color.fromString(element.getCssValue("background-color"));

  assertThat(backgroundColour).isEqualTo(new Color(0, 128, 0, 1));

  element = driver.findElement(By.id("red-item"));
  backgroundColour = Color.fromString(element.getCssValue("background-color"));

  assertThat(backgroundColour).isEqualTo(new Color(255, 0, 0, 1));
}
 
Example 2
Source File: CssValueTest.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetCssValueShouldReturnStandardizedColour() {
  driver.get(pages.colorPage);

  WebElement element = driver.findElement(By.id("namedColor"));
  Color backgroundColour = Color.fromString(element.getCssValue("background-color"));
  assertThat(backgroundColour).isEqualTo(new Color(0, 128, 0, 1));

  element = driver.findElement(By.id("rgb"));
  backgroundColour = Color.fromString(element.getCssValue("background-color"));
  assertThat(backgroundColour).isEqualTo(new Color(0, 128, 0, 1));
}
 
Example 3
Source File: BaseConfiguration.java    From webtester2-core with Apache License 2.0 4 votes vote down vote up
@Override
public Color getMarkingsColorUsedBackground() {
    return Color.fromString(getStringProperty(key(NamedProperties.MARKINGS_USED_BACKGROUND), "#ffd2a5"));
}
 
Example 4
Source File: BaseConfiguration.java    From webtester2-core with Apache License 2.0 4 votes vote down vote up
@Override
public Color getMarkingsColorUsedOutline() {
    return Color.fromString(getStringProperty(key(NamedProperties.MARKINGS_USED_OUTLINE), "#916f22"));
}
 
Example 5
Source File: BaseConfiguration.java    From webtester2-core with Apache License 2.0 4 votes vote down vote up
@Override
public Color getMarkingsColorReadBackground() {
    return Color.fromString(getStringProperty(key(NamedProperties.MARKINGS_READ_BACKGROUND), "#90ee90"));
}
 
Example 6
Source File: BaseConfiguration.java    From webtester2-core with Apache License 2.0 4 votes vote down vote up
@Override
public Color getMarkingsColorReadOutline() {
    return Color.fromString(getStringProperty(key(NamedProperties.MARKINGS_READ_OUTLINE), "#008000"));
}
 
Example 7
Source File: BaseConfiguration.java    From webtester-core with Apache License 2.0 4 votes vote down vote up
@Override
public Color getMarkingsColorUsedBackground() {
    return Color.fromString(getStringProperty(key(NamedProperties.MARKINGS_COLOR_USED_BACKGROUND), "#ffd2a5"));
}
 
Example 8
Source File: BaseConfiguration.java    From webtester-core with Apache License 2.0 4 votes vote down vote up
@Override
public Color getMarkingsColorUsedOutline() {
    return Color.fromString(getStringProperty(key(NamedProperties.MARKINGS_COLOR_USED_OUTLINE), "#916f22"));
}
 
Example 9
Source File: BaseConfiguration.java    From webtester-core with Apache License 2.0 4 votes vote down vote up
@Override
public Color getMarkingsColorReadBackground() {
    return Color.fromString(getStringProperty(key(NamedProperties.MARKINGS_COLOR_READ_BACKGROUND), "#90ee90"));
}
 
Example 10
Source File: BaseConfiguration.java    From webtester-core with Apache License 2.0 4 votes vote down vote up
@Override
public Color getMarkingsColorReadOutline() {
    return Color.fromString(getStringProperty(key(NamedProperties.MARKINGS_COLOR_READ_OUTLINE), "#008000"));
}
 
Example 11
Source File: BasicKeyboardInterfaceTest.java    From selenium with Apache License 2.0 4 votes vote down vote up
private void assertBackgroundColor(WebElement el, Colors expected) {
  Color actual = Color.fromString(el.getCssValue("background-color"));
  assertThat(actual).isEqualTo(expected.getColorValue());
}