SmallX
SmallX

Reputation: 69

How to click on an element in a list in robot framework

How can i select settings from this dropdown list. I tried Click Element by(class/id..) but none of them work for me.

First i have to click on the profile icon, then choose the settings element

here is the html code of the icon :

<li class="dropdown userMenu hidden-sm hidden-xs" id="y7">
                              
                              <a data-toggle="dropdown" class="dropdown-toggle pad10-top no-padding-left no-padding-right center" href="javascript:void(0)" id="yu">
                              <span class="ellipsis-menu no-margin pad5-bottom" data-toggle="tooltip" data-placement="bottom" title="Profile" id="yui_3_">
                              <i aria-hidden="true" class=" icon-user_icon pad5-right" id="y"></i>
                              </span>
                              <b class="caret"></b>
                              </a>

and here is the element of the list that i want to select :

<li id="y8">
<a id="settings" href="/cc/settings.html"><i class=""></i>Settings</a></li>

Any help please?

Upvotes: 2

Views: 2142

Answers (1)

Anand Gautam
Anand Gautam

Reputation: 2101

This should work. Assuming that the list line element is of profile icon (It was unclear to me from the HTML you pasted, but you may better figure out on your application by inspecting it). If needed be, you may apply a Sleep of 1-2 sec in between the two lines

Click Element       xpath: //*[@title='Profile']
Click Element       id: settings

P.S. I am assuming that you have imported all the required libraries for this (in fact, it is only SeleniumLibrary that is required for these two lines)

Upvotes: 2

Related Questions