本文整理汇总了Java中org.openqa.selenium.support.Color类的典型用法代码示例。如果您正苦于以下问题:Java Color类的具体用法?Java Color怎么用?Java Color使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Color类属于org.openqa.selenium.support包,在下文中一共展示了Color类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: styleIsChangedIfMarkingsAreActivated
import org.openqa.selenium.support.Color; //导入依赖的package包/类
@Test
public void styleIsChangedIfMarkingsAreActivated() {
doReturn(Color.fromString("#aaaaaa")).when(configuration).getMarkingsColorReadBackground();
doReturn(Color.fromString("#bbbbbb")).when(configuration).getMarkingsColorReadOutline();
doReturn(true).when(configuration).isMarkingsEnabled();
cut.markAsRead(fragment);
verify(styleChanger).changeStyleInformation(same(fragment), cssCaptor.capture());
Map<String, String> properties = cssCaptor.getValue();
assertThat(properties).containsEntry(CssProperties.OUTLINE_STYLE, "solid");
assertThat(properties).containsEntry(CssProperties.OUTLINE_WIDTH, "2px");
assertThat(properties).containsEntry(CssProperties.OUTLINE_COLOR, "#bbbbbb");
assertThat(properties).containsEntry(CssProperties.BACKGROUND_COLOR, "#aaaaaa");
}
示例2: markElement
import org.openqa.selenium.support.Color; //导入依赖的package包/类
private void markElement(PageFragment fragment, Color backgroundColor, Color outlineColor) {
Map<String, String> cssStyleAttributes = new HashMap<>();
cssStyleAttributes.put(CssProperties.OUTLINE_STYLE, "solid");
cssStyleAttributes.put(CssProperties.OUTLINE_WIDTH, "2px");
cssStyleAttributes.put(CssProperties.OUTLINE_COLOR, outlineColor.asHex());
cssStyleAttributes.put(CssProperties.BACKGROUND_COLOR, backgroundColor.asHex());
styleChanger.changeStyleInformation(fragment, cssStyleAttributes);
}
示例3: markingsColorUsedBackgroundCanBeChanged
import org.openqa.selenium.support.Color; //导入依赖的package包/类
@Test
void markingsColorUsedBackgroundCanBeChanged() {
Color color = Colors.BLUEVIOLET.getColorValue();
Configuration configuration = cut.setMarkingsColorUsedBackground(color);
assertThat(cut.getMarkingsColorUsedBackground()).isEqualTo(color);
assertThat(configuration).isSameAs(cut);
}
示例4: markingsColorUsedOutlineCanBeChanged
import org.openqa.selenium.support.Color; //导入依赖的package包/类
@Test
void markingsColorUsedOutlineCanBeChanged() {
Color color = Colors.ALICEBLUE.getColorValue();
Configuration configuration = cut.setMarkingsColorUsedOutline(color);
assertThat(cut.getMarkingsColorUsedOutline()).isEqualTo(color);
assertThat(configuration).isSameAs(cut);
}
示例5: markingsColorReadBackgroundCanBeChanged
import org.openqa.selenium.support.Color; //导入依赖的package包/类
@Test
void markingsColorReadBackgroundCanBeChanged() {
Color color = Colors.ANTIQUEWHITE.getColorValue();
Configuration configuration = cut.setMarkingsColorReadBackground(color);
assertThat(cut.getMarkingsColorReadBackground()).isEqualTo(color);
assertThat(configuration).isSameAs(cut);
}
示例6: markingsColorReadOutlineCanBeChanged
import org.openqa.selenium.support.Color; //导入依赖的package包/类
@Test
void markingsColorReadOutlineCanBeChanged() {
Color color = Colors.AZURE.getColorValue();
Configuration configuration = cut.setMarkingsColorReadOutline(color);
assertThat(cut.getMarkingsColorReadOutline()).isEqualTo(color);
assertThat(configuration).isSameAs(cut);
}
示例7: getSeriesColorAtXAxisPosition
import org.openqa.selenium.support.Color; //导入依赖的package包/类
protected Color getSeriesColorAtXAxisPosition(int series,
String xAxisLabelValue) {
// The series can vary depending on the structure of the chart, by
// default it is fine but if this doesn't work you may need to tweak the
// series
int barNumber = getXAxisLabelsText().indexOf(xAxisLabelValue);
// The below varies depending on the structure of the chart, by default
// we need to multiply by 4
barNumber = barNumber * 4;
return Color.fromString(chart.findElement(
By.cssSelector(".highcharts-series-group > g:nth-of-type("
+ series + ") > rect:nth-of-type(" + barNumber + ")"))
.getAttribute("fill"));
}
示例8: markAsUsed
import org.openqa.selenium.support.Color; //导入依赖的package包/类
/**
* Marks the given {@link PageObject page object} as 'used' using the
* configured colors from the page object's browser's {@link Configuration
* configuration}.
*
* @param pageObject the page object to mark.
* @since 0.9.6
*/
public static void markAsUsed(PageObject pageObject) {
Configuration configuration = pageObject.getBrowser().getConfiguration();
if (configuration.markingsAreActivated()) {
Color backgroundColor = configuration.getMarkingsColorUsedBackground();
Color outlineColor = configuration.getMarkingsColorUsedOutline();
markElement(pageObject, backgroundColor, outlineColor);
}
}
示例9: markAsRead
import org.openqa.selenium.support.Color; //导入依赖的package包/类
/**
* Marks the given {@link PageObject page object} as 'read' using the
* configured colors from the page object's browser's {@link Configuration
* configuration}.
*
* @param pageObject the page object to mark.
* @since 1.2
*/
public static void markAsRead(PageObject pageObject) {
Configuration configuration = pageObject.getBrowser().getConfiguration();
if (configuration.markingsAreActivated()) {
Color backgroundColor = configuration.getMarkingsColorReadBackground();
Color outlineColor = configuration.getMarkingsColorReadOutline();
markElement(pageObject, backgroundColor, outlineColor);
}
}
示例10: markElement
import org.openqa.selenium.support.Color; //导入依赖的package包/类
private static void markElement(PageObject pageObject, Color backgroundColor, Color outlineColor) {
Map<CSSProperty, String> cssStyleAttributes = new HashMap<CSSProperty, String>();
cssStyleAttributes.put(CSSProperties.OUTLINE_STYLE, "solid");
cssStyleAttributes.put(CSSProperties.OUTLINE_WIDTH, "2px");
cssStyleAttributes.put(CSSProperties.OUTLINE_COLOR, outlineColor.asHex());
cssStyleAttributes.put(CSSProperties.BACKGROUND_COLOR, backgroundColor.asHex());
styleChanger.changeStyleInformation(pageObject, cssStyleAttributes);
}
示例11: toString
import org.openqa.selenium.support.Color; //导入依赖的package包/类
private String toString(Color color) {
for (Colors namedColor : Colors.values()) {
if (namedColor.getColorValue().equals(color))
return namedColor.toString().toLowerCase();
}
return color.asHex().toLowerCase();
}
示例12: matchesSafely
import org.openqa.selenium.support.Color; //导入依赖的package包/类
@Override
protected boolean matchesSafely(WebElement item,
Description mismatchDescription) {
Color actualColor = Color.fromString(item.getCssValue(attributeName));
if (actualColor.equals(expectedColor))
return true;
else {
mismatchDescription.appendText(attributeName + " was " + toString(actualColor));
return false;
}
}
示例13: getAttributeAsColor
import org.openqa.selenium.support.Color; //导入依赖的package包/类
/**
* Return the given attribute as a color or null if the attribute is not
* specified.
*
* @param attributeName
* @return
*/
public Color getAttributeAsColor(String attributeName) {
try {
return Color.fromString(element.getAttribute(attributeName));
} catch (Exception e) {
return null;
}
}
示例14: getMarkingsColorUsedBackground
import org.openqa.selenium.support.Color; //导入依赖的package包/类
@Override
public Color getMarkingsColorUsedBackground() {
return Color.fromString(getStringProperty(key(NamedProperties.MARKINGS_USED_BACKGROUND), "#ffd2a5"));
}
示例15: setMarkingsColorUsedBackground
import org.openqa.selenium.support.Color; //导入依赖的package包/类
@Override
public BaseConfiguration setMarkingsColorUsedBackground(Color color) {
return setProperty(key(NamedProperties.MARKINGS_USED_BACKGROUND), color.asHex());
}