
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.