如何从带有机器人框架的菜单栏中选择一个选项

时间:2017-04-12 04:33:34

标签: robotframework option menubar selenium2library

我想从菜单栏中选择一个选项,但我可以找到它们的定位器。

这里是菜单栏的源代码:

<aside class="sidebar" id="left-sidebar">
<div class="sidebar__overlay clearfix sidebar__overlay--shown" id="sidebar-overlay"></div>
<div id="sidebar-container" class="sidebar__container dropdown-open" style="max-height: 817px; display: block;">
    <div class="sidebar__item">
        <a href="/a/thao/">
            <div class="sidebar__item-icon sidebar__item-icon--home"><i class="fa fa-home"></i></div>
            <div class="sidebar__item-title sidebar__item-title--home"><strong data-l10n-id="sidebar_home">Home</strong></div>
        </a>
    </div>
    <div class="sidebar__item">
        <div>
            <div class="sidebar__item-icon sidebar__item-icon--space"></div>
            <div class="sidebar__item-title sidebar__item-title--space"><strong data-l10n-id="widget_space">Space</strong></div>
        </div>
    </div>
    <div class="sidebar__item sidebar__item--notifications">
        <div>
            <div class="sidebar__item-icon sidebar__item-icon--notifications"></div>
            <div class="sidebar__item-title sidebar__item-title--notifications"><strong data-l10n-id="sidebar_notifications">Notifications</strong> <span class="sidebar__notification-icon"><i class="fa fa-exclamation"></i></span> </div>
        </div>
    </div>
    <div class="sidebar__item">
        <div>
            <div class="sidebar__item-icon sidebar__item-icon--annoucements"></div>
            <div class="sidebar__item-title sidebar__item-title--annoucements"><strong data-l10n-id="sidebar_annoucements">Announcements</strong></div>
        </div>
    </div>
    <div class="sidebar__item">
        <div>
            <div class="sidebar__item-icon sidebar__item-icon--application"></div>
            <div class="sidebar__item-title sidebar__item-title--application"><strong data-l10n-id="widget_apps">Application</strong></div>
        </div>
    </div>
    <div class="sidebar__item">
        <div>
            <div class="sidebar__item-icon sidebar__item-icon--user"><i class="fa fa-user"></i></div>
            <div class="sidebar__item-title sidebar__item-title--user"><strong data-l10n-id="sidebar_user">User</strong></div>
        </div>
    </div>
    <div class="sidebar__item">
        <a href="/a/thao/management">
            <div class="sidebar__item-icon sidebar__item-icon--management"><i class="fa fa-cog"></i></div>
            <div class="sidebar__item-title sidebar__item-title--management"><strong data-l10n-id="sidebar_management">Management</strong></div>
        </a>
    </div>
    <div class="sidebar__item">
        <a href="/a/thao/support" target="_blank">
            <div class="sidebar__item-icon sidebar__item-icon--support"><i class="fa fa-question-circle"></i></div>
            <div class="sidebar__item-title sidebar__item-title--support"><strong data-l10n-id="sidebar_support">Help and Support</strong></div>
        </a>
    </div>
</div>

我想选择&#34;管理&#34;所以我在机器人框架中编写脚本:

Wait Until Element Is Visible    css=a.sidebar__item-icon.sidebar__item-icon--management
Click Link    css=a.sidebar__item-icon.sidebar__item-icon--management

但它没有运行,因为定位器没有匹配任何元素。 请帮我解决!!!!

1 个答案:

答案 0 :(得分:1)

尝试

temp_pdf.path

让我知道是否有任何问题