Unable to select the dropdown list

0 votes

In the dropdown list, the Edition element is already selected. but if we are trying to select the next element"Free Edition". it is not going to hit.

Please find the HTML code

<select name="payment_plan_id" id="payment_plan_id" class="form-control input-text" size="1" onchange="showEditionText(this.value);" data-bv-field="payment_plan_id" xpath="1" style="">

<small data-bv-validator="notEmpty" data-bv-validator-for="payment_plan_id" class="help-block" style="display: none;">Please select one Edition mode</small>

                  <option value="" disabled="" selected="">Edition</option>

                  <option value="1">Free Edition</option>

                <option value="5">CRMPRO - $29.95 user/mo.</option>

</select>

I tried the below code to select the "Free edition"

One Way :driver.findElement(By.xpath(prop.getProperty("Sign_Up_xpath"))).click();

Thread.sleep(3000);

WebElement element=driver.findElement(By.id(prop.getProperty("Edition_id")));

Select set= new Select(element);

set.deselectByVisibleText("Free Edition");

2nd Way:  

WebElement element=driver.findElement(By.id(prop.getProperty("Edition_id")));

List<WebElement> options=element.findElements(By.tagName("option"));

for(WebElement web:options)

{

if(web.isEnabled()==false)

{

web.findElement(By.tagName("1")).click();

}

}Could anyone please suggest, how to select the option.

Aug 19, 2021 in Selenium by Edureka

edited Mar 4 24 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP