How to write code for toggle

image
i have a toggle button with on and off but in the code i can see before::after
am not aware how to write xpath for this
and based on the toggle ON and Off i need to click on it
KIndly let me know how can i proceed
If i use CSS selector i can see this
body > div:nth-child(11) > div.modal-body > form > div:nth-child(1) > div > div > label > div.onoffswitch-inner

but not knowing exactly its ON/OFF how to know it

Hey Shiva @ShivaRaju, maybe try checking the solution from the previous post here about handling the toggle button.

@ShivaRaju ,I have the same issue.How do you resolve this?

Display your HTML and others may be able to help you. Note that the “::before”/“::after” is not what you are looking for. Instead, right click on your toggle element and select “Inspect” (do this twice). Then the HTML for your element will be available. Otherwise, check out what @chen.lee has in his hyperlink above.