matecki Posted June 2, 2020 Share Posted June 2, 2020 (edited) 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 June 2, 2020 by matecki Link to comment Share on other sites More sharing options...
Danp2 Posted June 2, 2020 Share Posted June 2, 2020 @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. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
matecki Posted June 3, 2020 Author Share Posted June 3, 2020 (edited) 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 June 3, 2020 by matecki Link to comment Share on other sites More sharing options...
Danp2 Posted June 3, 2020 Share Posted June 3, 2020 It can't find the designated element, so your xpath is wrong. Once you correct that, you should be able to open it using _WD_ElementAction / Click. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now