Jonathan
Jonathan

Reputation: 395

Protractor hard to click popup/dropdown

Hey guys I am trying to click on an element called practitioner access on my company's web site and I have tried looking up documentation on stack over flow and have not figured out how to do this exactly I need help. What I am trying to do is click on the practitioner access popup/drop down and I have not been able to find the code to do it. Please see epic at the bottom:

enter image description here This is how far I have gotten so far but protractor cant find the element

var pracaccess = element(by.xpath("//contains(@onclick, 'Practitioner Access')"))
pracaccess.click();
browser.sleep(10000);

I have tried to use these site to try and help myself but I can't piece it together. Any help would be appreciated. I am new to xpath as well.


new info to possibly help: Here is a more expanded view

enter image description here

Also this is what it looks like in vb-script but its basically the same any suggestions?

Browser("ADP_2").Page("ADP_3").Link("html tag:=A","innertext:=Practitioner Access").WaitProperty "visible",True,30000
        Browser("ADP_2").Page("ADP_3").Link("html tag:=A","innertext:=Practitioner Access").Object.Click

Upvotes: 0

Views: 90

Answers (2)

andriyze
andriyze

Reputation: 484

The answer by alecxe is correct but if you want it to be as xpath:

element(by.xpath('//a[text()="Practitioner Access"]'));

Upvotes: 0

alecxe
alecxe

Reputation: 473873

This XPath expression would look for a tag with the contains tag name, which does not exist. Instead, you've actually meant:

//a[contains(@onclick, 'Practitioner Access')]

Or, there is a nicer way to locate an a element by the link text:

element(by.linkText("Practitioner Access"))

Upvotes: 2

Related Questions