Jump to content

Click dropdown menu item


Recommended Posts

Hi, Is it possible to click dropdown menu item? I've got two menu items: 

<li id="formMenu_form_0-353_li_down" class="pui-menuitem ui-widget ui-corner-all pui-menu-parent"><a class="pui-menuitem-link ui-corner-all"><span class="pui-submenu-icon fa fa-fw fa-caret-down"></span><span class="pui-menuitem-text">Go to</span></a><ul class="ui-widget-content pui-menu-list ui-corner-all ui-helper-clearfix pui-menu-child pui-shadow"><li id="li-352" class="pui-menuitem ui-widget ui-corner-all"><a class="pui-menuitem-link ui-corner-all"><span class="pui-menuitem-text">Task</span></a></li></ul></li>

I must click "Go to" and then "Task". I am trying something like this, but it gives me ton of errors>

$sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@class='"&pui-menuitem ui-widget ui-corner-all pui-menu-parent&"']")

 

Edited by matecki
Link to comment
Share on other sites

@matecki Not sure why you are trying to concatenate strings. Just do this --

$sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@class='pui-menuitem ui-widget ui-corner-all pui-menu-parent']")

Note: You can't click an element that isn't visible, so you likely will need to trigger the dropdown to open first.

Link to comment
Share on other sites

16 hours ago, Danp2 said:

@matecki Not sure why you are trying to concatenate strings. Just do this --

$sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@class='pui-menuitem ui-widget ui-corner-all pui-menu-parent']")

Note: You can't click an element that isn't visible, so you likely will need to trigger the dropdown to open first.

Thank you, Could you tell me how can  i trigger the dropdown? I am beginner andi have no idea how to do this. I am trying to dropdown list first by this: 

$sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='formMenu_form_0-353_li_down']")

or: 

$sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@class='pui-menuitem ui-widget ui-corner-all pui-menu-parent']")

but its not working. And this is my stack trace:

_WD_FindElement: {"value":{"error":"no such element","message":"Unable to locate element{\"method\"\"xpath\",\"selector\"\"//input[@id='formMenu_form_0-353_li_down']

 

Edited by matecki
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...