Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97825

How do i fetch the text which is a part of grandparent?

$
0
0

How do i fetch the name "JAFFERYI ADI" from the following html code? Have to fetch the name within for loop every time name will be different only the word 'years' will be common. I tried with

"driver.findElement(By.xpath("//div[@class='patient-slide-header']/div[contains(text(), 'years')]"

but found NoSUchELementException. Please help. Here is the html DOM

<div class="patient-slide-header" style="" xpath="1">
    <div class="patient-slide-header patient-slide-header-h2" style="">
        <a onclick="objPatientDetail.NavigatePatient('backward');" href="#" class="prev-patient patient-details-navigation" style=""></a>
        JAFFERYI ADI (56 years)
    <div class="patient-slide-header-details"></div>
    <a onclick="objPatientDetail.NavigatePatient('forward');" class="next-patient patient-details-navigation" href="#" style=""></a>
    <input type="hidden" id="hdnHIEurl">
</div>

Viewing all articles
Browse latest Browse all 97825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>