diff --git a/src/main/java/pl/labno/bernard/htmlunified/WebClientUtils.java b/src/main/java/pl/labno/bernard/htmlunified/WebClientUtils.java
index b65af72..000bcbc 100644
--- a/src/main/java/pl/labno/bernard/htmlunified/WebClientUtils.java
+++ b/src/main/java/pl/labno/bernard/htmlunified/WebClientUtils.java
@@ -4,9 +4,11 @@ import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.DomNode;
import com.gargoylesoftware.htmlunit.html.DomNodeList;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlTableCell;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -128,4 +130,20 @@ public class WebClientUtils {
}
}
}
+
+ public static void setColorPickerValue(WebClient webClient, HtmlElement colorPicker, String hex) throws IOException {
+ HtmlPage page = (HtmlPage) webClient.getCurrentWindow().getEnclosedPage();
+ colorPicker.click();
+ ((HtmlInput) page.getElementById(colorPicker.getId() + "-colorPicker-hex")).setValueAttribute(hex);
+ page.getElementById(colorPicker.getId() + "-colorPicker-popup").getHtmlElementsByTagName("button").get(0).click();
+ }
+
+ public static void setColorPickerValue(WebClient webClient, HtmlElement colorPicker, int red, int green, int blue) throws IOException {
+ HtmlPage page = (HtmlPage) webClient.getCurrentWindow().getEnclosedPage();
+ colorPicker.click();
+ ((HtmlInput) page.getElementById(colorPicker.getId() + "-colorPicker-rgb-r")).setValueAttribute(Integer.toString(red));
+ ((HtmlInput) page.getElementById(colorPicker.getId() + "-colorPicker-rgb-g")).setValueAttribute(Integer.toString(green));
+ ((HtmlInput) page.getElementById(colorPicker.getId() + "-colorPicker-rgb-b")).setValueAttribute(Integer.toString(blue));
+ page.getElementById(colorPicker.getId() + "-colorPicker-popup").getHtmlElementsByTagName("button").get(0).click();
+ }
}