How to locate the element which has same class name and text as shown below

22 Views Asked by At

I need to click on the element which is there in the list but I am unable to click on the element I am using (//[@class="pb-dropdown__contents pb-dropdown__contents--no-margin pb-dropdown__contents-enter-done"])[0] and this one too //[@class="pb-dropdown__contents pb-dropdown__contents--no-margin pb-dropdown__contents-enter-done" and text()="Create"] but none seems to be working as the both the title of the dropdown and the List which i need to click on has same name and are of same class. Please help me out You can refer the DOM in this link(https://i.stack.imgur.com/cnbhu.png)

I tried with all these locators //*[@class="pb-site-nav-link__title" and text()="Create"]

(//[@class="pb-dropdown__contents pb-dropdown__contents--no-margin pb-dropdown__contents-enter-done"])[0] and this one too //[@class="pb-dropdown__contents pb-dropdown__contents--no-margin pb-dropdown__contents-enter-done" and text()="Create"]

1

There are 1 best solutions below

0
Dinesh Kumar On

Can you try this loactor:

//span[contains(@class,'title') and text()='Create']/parent::a