0

I'm currently doing a testcase for a program, and I need to check the checkbox in the e2e test.

Being new to e2e, I don't have a successful idea on how to do it for checkboxes

Any help or links appreciated.

1 Answer 1

4

Select your checkbox using locators, read up on them here

//in case your checkbox has an ID
var foo = element(by.id('checkboxId'));
foo.click();

//in case your checkbox doesn't have an ID or a unique identifier, use CSS
var bar = $('[type="checkbox"]');
bar.click();
Sign up to request clarification or add additional context in comments.

2 Comments

additionally you can verify if the chechbox is checked with foo.isSelected() (this returns a promise)
if you don't have jquery, then you can use element(by.css()) or element(by.xpath()) You can get css/xpaths by right-clicking on an inspected element in Chrome debugger

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.