Reputation: 1
How to select the value from the corresponding drop-down?
html
<select _ngcontent-c13="" class="s_patient_profile_input ng-pristine ng-valid ng-touched" formcontrolname="marital_status">
<option _ngcontent-c13="" value="Single">Single</option>
<option _ngcontent-c13="" value="Married">Married</option></select>
<option _ngcontent-c13="" value="Single">Single</option>
<option _ngcontent-c13="" value="Married">Married</option>
Upvotes: 0
Views: 784
Reputation: 6910
It doesn't need to be id
, you can use any finding strategy as long as the element is a supported dropdown selector. For example, this is by xpath
:
Select select = new Select(driver.findElement(By.xpath("//path_to_drop_down")));
select.deselectAll();
select.selectByVisibleText("Value1");
Upvotes: 1