Unable to locate button element

I get error “button with locator not found” when using this xpath

/html/body/app-root/body/div/div[1]/app-site-header/div/div[2]/div[2]/p-menubar/div/p-menubarsub/ul

I’ve tried clicking it using class locator, the HTML is

<span class="p-menuitem-icon  my-menu-icon  ng-star-inserted"></span>

My code

//*[contains(@class,“my-menu-icon”)]/html/body/app-root/body/div/div[1]/app-site-header/div/div[2]/div[2]/p-menubar/div/p-menubarsub/ul

This does not work either. I’ve also tried:

Wait Until Page Contains
Wait Until Element Is Visible
Wait Until Page Contains Element

Everything else is working so I know my environment should be ok.

Env.

Python 3.6.7

This error to me is indicating that you are using a Click Button keyword which expects either an input html element or a button html element. If, as seen in the sample html given, the element is an unorder list (<ul>) or span then Click Button would fail. Try the generic Click Element keyword instead.

1 Like