I've the following html and I want to select third option which is Off (optional) using selenium PHP-webdriver. Can anyone please tell me how can I do this?
In this HTML, all ids, are dynamically generated. So that I can not use id to find an element e.g I can not use this:
$driver->findElement(WebDriverBy::id('ajax-item-ExchangeEmail-12345'));
Can we use cssSelector() or xpath()? If yes, then how?
Thanks.
<div id="ajax-item-12345" class="input-group" title="ExchangeEmail">
<label class="input-group-addon" for="ajax-item-ExchangeEmail-12345">ExchangeEmail</label>
<select id="ajax-item-ExchangeEmail-12345" class="form-control" name="category_resource[12345]">
<option value="2">On (mandatory)</option>
<option value="1">On (optional)</option>
<option value="0">Off (optional)</option>
<option value="3">Off (mandatory)</option>
</select>
</div>