How to click on an item in a list that was opened from a dropdown

4 views
Skip to first unread message

Adam Parrish

unread,
Jan 29, 2013, 11:51:40 AM1/29/13
to testa...@googlegroups.com
Hi:

I am trying to get all hot and heavy with this e2e testing business. 

I have a bit of html that is used to have an input with a button on its right that opens a dropdown. Something like this:

<input id="input0"><button id="dropDownButton0">SelectedValue</button>
<ul id="dropdownOptions0">
<li>Option 1</li>
<li>Option 2</li>
</ul>

I am using some syntax like this to get an element and attempt to click on it:

it('Should have some options and clicking on one should set the button's text to be the selected value', function() {

browser().navigateTo('/');
expect(browser().window().hash()).toMatch('/');

var dropdownBtn = element('#dropdownButton0');
dropdownBtn.click();

var item2 = element('#dropdownOptions0 li:nth-child(2)');
item2.click();

//note that at this point if I pause item 2 was not clicked
pause();
});

I guess I see when I pause the runner that item 2 was not clicked because when I do it via just clicking in a normal browser something happens on the UI. Whats the right way to click on this? Do I need to make sure I have buttons in each <li> tag that are clickable?

Thanks for the help!

Adam 

Vojta Jína

unread,
Feb 2, 2013, 4:30:41 PM2/2/13
to testa...@googlegroups.com
How is the action registered ? Is there any onlick listener on the <li> ?
Angular's scenario runner just triggers a click event.

Can you make sure that the '#dropdownOptions0 li:nth-child(2)' selector really returns the element ?
Try something like
element('#dropdownOptions0....').query(function(elm, done) {
  console.log(elm);
  done();
});

V.



Adam 

--
You received this message because you are subscribed to the Google Groups "testacular" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testacular+...@googlegroups.com.
To post to this group, send email to testa...@googlegroups.com.
Visit this group at http://groups.google.com/group/testacular?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages