0
我想從菜單欄中選擇一個選項,但我可以找到它們的定位器。如何從機器人框架的菜單欄中選擇一個選項
這裏的菜單欄的源代碼:
<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="https://stackoverflow.com/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="https://stackoverflow.com/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="https://stackoverflow.com/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>
我想選擇的選擇 「管理」,所以我在robotframework寫劇本:
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
但它不是因爲跑定位器與任何元素都不匹配。 請幫我解決它!
仔細檢查你的CSS選擇器。 'css = a.' vs'css = div.' –
剛剛編輯。謝謝 –