Question

24
Views
Close popover
Troy Palmer (TroyP995)
Callaghan Innovation

Callaghan Innovation
NZ
TroyP995 Member since 2020 1 post
Callaghan Innovation
Posted: November 5, 2020
Last activity: November 5, 2020

Help with automating a menu selection

Hi,

I am trying to click the following menu in the attached screen shot with selenium web driver using a java implementation

Whenever I use an xpath locator such as //*[@class = 'menu-item-title' and text()= 'New'] and I search the DoM of the page in question I get 1 instance of the xpath locator.

However when I run my tests I get the following error:

org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@class = 'menu-item-title' and text()= 'New'] "}

there are a number of different unique locators for the "+" and "new" menus which all result in the unable to locate element error in the console.

when I record and run the same set of steps using the selenium IDE it uses xpath=//span[2]/span to click the link and works fine, however if I update my test to use this xpath it results in the same unable to locate element.

I have tried switching frames and almost everything else I can think of but with no success.

Any help with this would be fantastic.

 

Kind Regards

Troy

 

 

 

 

Pega Government Platform 8.4 User Experience Technology Services QA Specialist