'How to automate input type=“color” [ html5 color picker ] in selenium webdriver?

Scenario: Choose color, and Close the window. when I click on the html element color (input type=color) it opens a color picker which is a window pop_up. I am not able to view DOM of the window. I want to either click on any color and close window or enter any hex code in the textbox present on window popup. Please help me with the code for the same

enter image description here

Please note - tried with this solution How to automate input type="color" in selenium webdriver? but it is not working for me on html5.



Solution 1:[1]

I believe you want to use the value of the input color box after the user selects a color and clicks on the close button / enters the hex value. Use the following for getting the value of the Input color Box :

<body>

<input type="color" onchange="changeFunction(this)">

<script>

function changeFunction(element)
{
  console.log(element.value)
}

</script>
</body>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 back_to_square