I have found that I needed to have a few ways to select drop down values,
depending on how the site was coded. So in my framework I have few ways of
doing it:

new SelectElement(driver.FindElement(By.Id(elementname))).SelectByText(

new SelectElement(driver.FindElement(By.Id(elementname))).SelectByValue(

new SelectElement(driver.FindElement(By.Name(elementname))).SelectByText(

The first two are by ID, but select Text over Value, in this case it was
which was more understandable, so if Text is the name of the item such as
"Dog" for example, versus the value being 1, I'd use Text instead. Everyone
understand what dog means versus what 1 means.

However in some cases the value and text were the same, and 1 or 1 so it
didn't matter, and I've had web controls that does not provide text, just a

The last option finds it by name, in those cases where the web control did
not have id

Just depends on how consistent the Developers were on the web page controls
they created. So you kinda of have to experiment with which will work for
each case.

Hope that helps,
On Wednesday, April 29, 2015 at 6:27:54 AM UTC-7, Bryan Kardisco wrote:

I'm attempting to select a drop-down box with the Firefox Driver and am
being told the element is hidden. However, when opening the URL the link
is there and can be clicked.

I am doing the following:

WebElement inputElement = driver

Object obj = ((JavascriptExecutor) driver)

new Select(inputElement).selectByIndex(2);

Anything else I can do?
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/7c3956f2-8132-4d1d-aa31-04355a49854d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts


Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 5 | next ›
Discussion Overview
groupselenium-users @
postedApr 29, '15 at 1:27p
activeApr 30, '15 at 6:37p



site design / logo © 2022 Grokbase