RE: Unable to select value from dropdown in selenium webdriver

I am trying to select values in dropdown using selenium web driver

Select dropdown = new Select(driver.findElement(“pnlMain_ContentPlaceHolder1_DiaryView_pcAppCreate_AppoinmentControl_cpAppointment_ddlOffTerritoryType_B-1”))).selectByValue(“Conference”);

But i am getting error

Exception in thread “main” java.lang.Error: Unresolved compilation problem:
Type mismatch: cannot convert from void to Select
kindly advise

sarikadonlopes Default Asked on January 16, 2017 in Selenium WebDriver.
Add Comment
1 Answers

You need to invoke the ‘selectByValue’ method on the object of ‘Select’ class type.

Try as below:

Select dropdown = new Select(driver.findElement(“pnlMain_ContentPlaceHolder1_DiaryView_pcAppCreate_AppoinmentControl_cpAppointment_ddlOffTerritoryType_B-1″)));


Default Answered on January 17, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.