Search code examples
javaselenium-webdriverselenium3

Not able to toggle switch using style and its status using selenium web-driver


I am new to selenium web driver and I want to automate the toggle switch. When I turn it "On", I can see style shows ":checked", in HTML section of firebug. Please refer attached screenshot.

So how I can locate this toggle switch, using style with status "checked".

I also tried with printing getCssValue("background-color"). I was expecting #444, but got #fff. So it did not work.

I have many other options to locate it but, I want to locate this element with style and status as "checked" only.

enter image description here


Solution

  • I got the answer:

     input.checkbox-slider[type='checkbox']:checked