protractor icon indicating copy to clipboard operation
protractor copied to clipboard

unable to select drop down values by visible text

Open prakashomp opened this issue 12 years ago • 7 comments

Hi, how to select a value from search box+drop(ajax text field) down by protractor?

Regards Om Prakash

prakashomp avatar Jul 04 '14 06:07 prakashomp

ptor.driver.findElement(protractor.By.xpath('//*[@id="region"]/option[text()="YourSearchTextHere"]')).click();

smahalingam avatar Jul 04 '14 15:07 smahalingam

unable to select text by using page object.

prakashomp avatar Jul 07 '14 09:07 prakashomp

It depends on the way that the drop down is implemented. You'll probably need to use css selectors.

juliemr avatar Jul 07 '14 16:07 juliemr

Elements are identifying before page load . It is working for non-angular applications. i kept browser.waitForAngular(); checked with browser.isElemenetPresent(by.css('element')); then also not working for angular applications.

prakashomp avatar Jul 08 '14 04:07 prakashomp

I'm sorry, I need more information to be able to help you. Could you share your test code or the HTML of the dropdown?

juliemr avatar Jul 08 '14 17:07 juliemr

Currently i am using this Pageobjectelemnt .$('[value='+variable+']').click(); I want to pass visible text instated of passing exact value. Drop down have the behavior as list out by sorting on typing(Ajax).

prakashomp avatar Jul 10 '14 05:07 prakashomp

There's no general way to sort by visible text instead of exact value. You could try xpaths as @smahalingam suggested.

This doesn't seem to be a bug or feature request for Protractor, so I'm going to close the issue so we can keep our github repo tidy. Please ask general questions on stack overflow.

juliemr avatar Jul 10 '14 17:07 juliemr