In my application, there is a drop down to select "Estimation Date":

enter image description here

Please find below my test case. It is failing at the line where I am trying to select "Since":

public class dropdown_issue {

    GenericFunctions gf= new GenericFunctions();

    @Test(enabled = true)

    public void dropdown () throws InterruptedException{
        WebDriver dr=new FirefoxDriver();

        WebElement est_date_dd= dr.findElement(By.xpath("//div[@class='clearfix']//select[@name='est-date']"));
        Select est_date= new Select(est_date_dd);
  • 1
    Hi Aalok, I observe this same behavior. "SelectByValue( )" is not working sometime. Work Around, When you open listbox using name I was able to click & set the actual value to list box. Let me know if it works for you too! Commented Jun 27, 2017 at 7:13
  • Thanks @NarendraC, the workaround worked. Now, trying to do it the right way. Is there any chance that I use Java script in order to accomplish this?
    – Aalok
    Commented Jun 28, 2017 at 4:00
  • Great. Its fine, I have not used JS. You can use. I will add my answer below now, accept! Commented Jun 28, 2017 at 4:23

3 Answers 3


I observe this same behavior. "SelectByValue( )" doen not working sometime. Below solution worked well for me :

  • Click on listbox
  • Once list & options are visible, Assert/Check visibility for option which you want to select preferably by name locator
  • Then using click() perform click on that option & it will set the actual value to list box.
  • For confirmation, again you can check correct value is selected in listbox or not?

The value of the option is actually string:SINCE.

Either use this value or select by visible text:


// or est_date.selectByVisibleText("Since ");
  • Hello @alecxe, I figured it out and updated the value. But that didn't work either. But, thanks for analyzing the code. 1 up for that.
    – Aalok
    Commented Jun 28, 2017 at 3:55
  • @Aalok okay, thanks, what if you do est_date.selectByVisibleText("Since ");? (see the space after the "Since").
    – alecxe
    Commented Jun 28, 2017 at 4:00
  • Okay. Will try that and share an update because I didn't put a space earlier.
    – Aalok
    Commented Jun 28, 2017 at 4:02
  • Tried that but no success. Seems like Selenium does not get along well with angular. :). Thanks though!
    – Aalok
    Commented Jun 28, 2017 at 7:22

Looks like you are trying to automate AngularJS website..

From locators perspective, I don't see any problem in the code..

I would suggest to do the following -

Before selecting the drop down, try clicking on dropdown and see the code works or not.

    WebElement est_date_dd= 
    Select est_date= new Select(est_date_dd);

Let me know if this doesn't work.


  • Thanks for your inputs. I am getting this error when trying to select value "Since": FAILED: dropdown org.openqa.selenium.NoSuchElementException: Cannot locate option with value: Since
    – Aalok
    Commented Jun 27, 2017 at 7:16
  • Can you please try selecting with index and see whether it works or not? Are you providing the exact text which is there in Element tree?
    – mashkurm
    Commented Jun 27, 2017 at 8:44
  • Yes. I am proving the same exact text but it didn't work. I tried with the index too. But doesn't seem like working. :(. Although, thank you for you efforts.
    – Aalok
    Commented Jun 27, 2017 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.