2

I'm trying to check a simple input type=checkbox using Selenium with C#, this is the HTML code I'm using:

<div _ngcontent-c5="" class="check-item">
    <input _ngcontent-c5="" class="custom ng-untouched ng-pristine ng-valid" id="captcha" type="checkbox">
    <label _ngcontent-c5="" for="captcha" translate="">Text</label>
</div>

I've tried almost all possible approaches like XPath, ID, Class name with no success, this seems to be an Angular label or something like that Thanks in advance!

1 Answer 1

1

Have you tried By.CssSelector("[for='captcha']");? This is a css selector for labels that point to an input with an id.

Sign up to request clarification or add additional context in comments.

1 Comment

It does not work, it seems im dealing with a pseudelement here because im seeing ::before after the label

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.