简体   繁体   中英

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

在此处输入图片说明

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

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM