Very Urgent!! Unable to select from the Select drop down!!

92 views
Skip to first unread message

Sudhansu Sekhar panda

unread,
Apr 3, 2015, 8:15:22 AM4/3/15
to seleniu...@googlegroups.com
Hi All,

I am unable to select from a Select dropdown. I have tried using the below code but it didnt work for me.

Select select = new Select(driver.findElement(Locator));
select.selectByVisibleText(Option);

Also I tried by Index but it didnt work. I debugged and got the below error message.

"Executing JavaScript click function returned an unexpected error"

Note: The interesting part it is running fine in my local IE10 but while running from remote machine its not working and showing the above error message. 

Is there any alternative way to do this?

The Html content for the Select item 
<select id="myModal" class="span12 " isrequired="true" field-validate="" ng-options="loc.dbid as loc.serviceName for loc in locList() | orderBy:'name'" ng-model="" uid="t" title="">
<option id="unselectedLocOption" class="" value="" uid="unselectedLocOption">-- * Requested LOC: --</option>
<option value="0">P</option>
<option value="1">S/ Chronic</option>
<option value="2">SN / Long Term Care</option>
<option value="3">She</option>
<option value="4">Ski</option>
<option value="5">Sub</option>
</select>


Thanks,

Sudhansu

Madan Singh

unread,
Apr 3, 2015, 8:24:12 AM4/3/15
to seleniu...@googlegroups.com
Hi ,
Give the text value of option in place of option
select.selectByVisibleText("She");

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/852f006d-5421-41a2-9de3-ca32dda49181%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
M P Singh
9971360313

CH!NN@ K

unread,
Apr 3, 2015, 8:25:57 AM4/3/15
to seleniu...@googlegroups.com
Hi Sekhar, Try this way 

new Select(driver.findElement(By.Xpath("Locator"))).selectByVisibleText("Option");

---
Thanks & Regards,
Purushotham Karimbedu,
Drupal Developer and QA Engineer,
Website for Selenium : http://techlearn.in


On Fri, Apr 3, 2015 at 5:45 PM, Sudhansu Sekhar panda <sudhans...@gmail.com> wrote:

--

Sudhansu Sekhar panda

unread,
Apr 3, 2015, 9:00:39 AM4/3/15
to seleniu...@googlegroups.com
Hi,

Thanks for the suggestion but it didnt work for me.

Thanks,

Sudhansu

Sudhansu Sekhar panda

unread,
Apr 8, 2015, 12:19:16 AM4/8/15
to seleniu...@googlegroups.com
Hi All,

I am able to select from the Select class using Action class like below.

Actions action = new Actions(driver);
action.moveToElement(driver.findElement(By.xpath("//input[@type='checkbox']"))).sendKeys(Keys.TAB).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ENTER).build().perform();

but my concern is why it is unable to select from that Select dropdown using Select class? There are other Select dropdown but i am able to select using the Select class only. 

Thanks,

Sudhansu
Reply all
Reply to author
Forward
0 new messages