FAQ
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
  .findElement(
  By.id("diningAvailabilityForm-searchTimeid-base"))
  .findElement(By.id("searchTime-wrapper"))
  .findElement(By.name("searchTime"));


  Object obj = ((JavascriptExecutor) driver)
  .executeScript("$(\".searchTime\").click()");


  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/9593663f-25fb-40bf-a239-5c94142b5e58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Gopa Kishore Mindi at Apr 30, 2015 at 5:18 am
    Hi Bryan,

    If it is a Select drop down then use the Select class to select the drop
    down like elow.

    // Locate drop-down field
        Select select = new Select(getDriver().findElement(Locator));
        // Select value from drop-down by visibility text
        select.selectByVisibleText("the text that you want to select");


    If it does not work then let me know we can do using Action class.

    Note: The above code will only work if the above dropdown is a select type


    Thanks,

    Gopa
    On Wednesday, April 29, 2015 at 6:57:54 PM UTC+5:30, 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
    .findElement(
    By.id("diningAvailabilityForm-searchTimeid-base"))
    .findElement(By.id("searchTime-wrapper"))
    .findElement(By.name("searchTime"));


    Object obj = ((JavascriptExecutor) driver)
    .executeScript("$(\".searchTime\").click()");


    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/740fd015-058d-4358-9796-58e2a3c66a77%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Mukesh otwani at Apr 30, 2015 at 12:51 pm
    Hi Bryan,


    Follow below link and let me know if you are facing any issue while working
    with dropdown


    http://learn-automation.com/handle-dropdown-in-selenium-webdriver/
    On Wednesday, April 29, 2015 at 6:57:54 PM UTC+5:30, 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
    .findElement(
    By.id("diningAvailabilityForm-searchTimeid-base"))
    .findElement(By.id("searchTime-wrapper"))
    .findElement(By.name("searchTime"));


    Object obj = ((JavascriptExecutor) driver)
    .executeScript("$(\".searchTime\").click()");


    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/58582bee-1e69-40c4-84c8-56fcc676a583%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Murali seleniumtrainer at Apr 30, 2015 at 2:47 pm
    Hi,

    As said you can use Select class to select values from drop downs. If
    select class does not working, then use sendKeys(text to select);

    Thanks,
    http://seleniumtrainer.com/
    On Wednesday, April 29, 2015 at 6:57:54 PM UTC+5:30, 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
    .findElement(
    By.id("diningAvailabilityForm-searchTimeid-base"))
    .findElement(By.id("searchTime-wrapper"))
    .findElement(By.name("searchTime"));


    Object obj = ((JavascriptExecutor) driver)
    .executeScript("$(\".searchTime\").click()");


    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/412bee80-6472-4046-bde3-5ad4c12efd06%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Monica S. at Apr 30, 2015 at 6:37 pm
    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(
    elementval);

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

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

    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
    value.

    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,
    Monica
    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
    .findElement(
    By.id("diningAvailabilityForm-searchTimeid-base"))
    .findElement(By.id("searchTime-wrapper"))
    .findElement(By.name("searchTime"));


    Object obj = ((JavascriptExecutor) driver)
    .executeScript("$(\".searchTime\").click()");


    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupselenium-users @
categoriesselenium
postedApr 29, '15 at 1:27p
activeApr 30, '15 at 6:37p
posts5
users5
websiteseleniumhq.org

People

Translate

site design / logo © 2021 Grokbase