Home > Software engineering >  How to locate the element inside the <p> tags?
How to locate the element inside the <p> tags?

Time:11-15

I have a few elements inside this kind of tag as below:

enter image description here

How do I locate these kinds of elements

I tried to locate the foresaid element, which the Selenium C# is not working

CodePudding user response:

give the p tag you are looking for an id. Then lookup the element using

var driver = //whatever your driver is;

driver.FindElement(By.Id("element-id-goes-here"));

CodePudding user response:

You can use xpath to locate the p element:

//div[@data-testid='patientLink']/p

Later you can call the getText() of the element located by the above selector.

  • Related