Dima P
Dima P

Reputation: 11

Use vba selenium to choose option from drop menu

PLS help me with vba selenium code. There is drop menu (name Select Bookmark) inside there is list with three option, i need to choose third option.

Tried to use some code from other solution but without success.

<ul id="aaa" class="bbb"> == $0
    ::before
    <li class="ccc">
        ::before
        <select>
            <option value>Select Bookmark</option>
            <option value="Server\BHG-145">bookmark_one</option>
            <option value="Server\BHG-155">bookmark_two</option>
            <option value="Server\BHG-165">bookmark_three</option>
        </select>
        ::after
    </li>
</ul>

Upvotes: 1

Views: 676

Answers (1)

QHarr
QHarr

Reputation: 84465

You can use an attribute = value selector

driver.FindElementByCss("[value='Server\BHG-165']").selected = True
driver.FindElementByCss("[value='Server\BHG-165']").click

or select by index

driver.FindElementByCss(".ccc select").AsSelect.SelectByIndex 3

or by text

driver.FindElementByCss(".ccc select").AsSelect.SelectByText "bookmark_three"

Upvotes: 1

Related Questions