Hello All,
in my web page, i am trying to select an option from drop
down..
for that i am trying with
Select selectBox = new
Select(Globals.driver.findElement(By.xpath("XPATH of the dropdown")));
selectBox.selectByValue("value to select");

but this is giving following error:
org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should
have been "select" but was "input"

Can anybody please suggest what is wrong with my code, or any
more info is required to debug..

Thanks
satyendra

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Chaitanya krishna at Dec 18, 2012 at 11:52 am
    U can try in this manner satya,

    List<WebElement> wee=driver.findElements(By.xpath("Path of drop down"));
    for(WebElement we:wee){
    System.out.println(we.getText());
    if(we.getText().contains("Element to be selected")){
    we.sendKeys("Element to be selected");
    we.click();
    break;
    }
    }
    On Tuesday, December 18, 2012 3:30:40 PM UTC+5:30, satya wrote:

    Hello All,
    in my web page, i am trying to select an option from drop
    down..
    for that i am trying with
    Select selectBox = new
    Select(Globals.driver.findElement(By.xpath("XPATH of the dropdown")));
    selectBox.selectByValue("value to select");

    but this is giving following error:
    org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should
    have been "select" but was "input"

    Can anybody please suggest what is wrong with my code, or any
    more info is required to debug..

    Thanks
    satyendra
    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/uf4eE836EyYJ.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Prashanth sams at Dec 20, 2012 at 12:08 pm
    If you have Multiple drop-down elements then go with Data-driven techniques.

    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/wTWOtOaBchcJ.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Chandramouli ch at Dec 20, 2012 at 8:10 pm
    try this ....yar to select any one from ur drpdown(list)

    String a[] = selenium.getSelectoptions(locator of dropdown);
    for( int i=0;i<a.length;i++)
    {
    selenium.select("locator",a[i];
    }

    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/fRWf2oL0zzsJ.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Anji Prassana at Dec 21, 2012 at 3:58 am
    Hi Satyendra,
    The Select Class will only be useful if the DropDown is constructed with
    'Select' tag.In your case, Probably the Xpath of the Dropdown doesn't has
    this. Check your html source code of the dropdown.

    The Syntax and Usage of Select Class is as defined...
    Select(*webelement*)[source]<http://selenium.googlecode.com/svn/trunk/docs/api/py/_modules/selenium/webdriver/support/select.html#Select>
    ¶<http://selenium.googlecode.com/svn/trunk/docs/api/py/webdriver_support/selenium.webdriver.support.select.html#selenium.webdriver.support.select.Select>

    Constructor. A check is made that the given element is, indeed, a SELECT
    tag. If it is not, then an UnexpectedTagNameException is thrown.
    Args :

    - webelement - element SELECT element to wrap


    On Tue, Dec 18, 2012 at 3:30 PM, Satyendra Singh wrote:

    Hello All,
    in my web page, i am trying to select an option from drop
    down..
    for that i am trying with
    Select selectBox = new
    Select(Globals.driver.findElement(By.xpath("XPATH of the dropdown")));
    selectBox.selectByValue("value to select");

    but this is giving following error:
    org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should
    have been "select" but was "input"

    Can anybody please suggest what is wrong with my code, or any
    more info is required to debug..

    Thanks
    satyendra

    --
    You received this message because you are subscribed to the Google Groups
    "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to
    selenium-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.



    --
    Thanks&Regards
    Anjaneyulu P
    "The way you see the things is the way to think and is the way you react
    upon!!"

    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Shawn Knight at Dec 26, 2012 at 2:19 am
    could you provide your html code?
    On Tuesday, December 18, 2012 4:00:40 AM UTC-6, satya wrote:

    Hello All,
    in my web page, i am trying to select an option from drop
    down..
    for that i am trying with
    Select selectBox = new
    Select(Globals.driver.findElement(By.xpath("XPATH of the dropdown")));
    selectBox.selectByValue("value to select");

    but this is giving following error:
    org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should
    have been "select" but was "input"

    Can anybody please suggest what is wrong with my code, or any
    more info is required to debug..

    Thanks
    satyendra
    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/AvAt54ldpd4J.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupselenium-users @
categoriesselenium
postedDec 18, '12 at 10:00a
activeDec 26, '12 at 2:19a
posts6
users6
websiteseleniumhq.org

People

Translate

site design / logo © 2022 Grokbase