从下拉菜单中选择选项的最佳方法是什么?

时间:2019-03-27 01:12:52

标签: c# selenium-webdriver

我已经通过直接转到链接结果解决了该问题,但是我很好奇如何使自动化转到下拉列表并选择一个特定值。下拉菜单的编写方式与我的预期有所不同,这就是为什么我坚持这一点。在UI上,将鼠标放在其上,然后在选项扩展后单击所需的操作。

<div class="navigation">

        <div class="wrapper">
            <!-- Start PureCSSMenu.com MENU -->
            <ul class="pureCssMenu pureCssMenum">

//Here you have multiple dropdowns like the one below

<li class="level-0 pureCssMenui"><a class="level-0 pureCssMenui" 

href="#"><span>My Account</span><![if
                    gt IE 6]></a><![endif]><!--[if lte IE 6]><table><tr><td><![endif]-->
                        <ul class="pureCssMenum">
                            <li class="pureCssMenui"><a class="pureCssMenui" href="/Account/UserInfo.aspx">My Info</a></li>
                            <li class="pureCssMenui"><a class="pureCssMenui" href="/Account/ChangePassword.aspx">Change Password</a></li>
                            <li class="pureCssMenui"><a class="pureCssMenui" target="_blank" href="https://SOMELINK">Wiki</a></li>
                            <li class="pureCssMenui"><a class="pureCssMenui" href="/Account/WorkLogReport.aspx">View My Worklog</a></li>
                            <li class="pureCssMenui"><a class="pureCssMenui" href="/Account/TicketActivity.aspx">View My Ticket Activity</a></li>
                            <li class="pureCssMenui"><a class="pureCssMenui" href="/Account/ServerUpdatedRequests.aspx">Server Update Requests</a></li>
                            <li class="pureCssMenui"><a class="pureCssMenui" href="/Account/SaveSearchDetails.aspx">Save Search Details</a></li>
                        </ul>
                        <!--[if lte IE 6]></td></tr></table></a><![endif]-->
                    </li>

Selenium应该从所有下拉菜单中选择“我的帐户”,然后选择“查看我的票证活动”。

0 个答案:

没有答案