0
votes

I want to click on the href link as per attached image, And I've tried the below code but seems like it's not working. Please help me.

.....

driver.findElement(By.xpath("//a[@href='Careers']")).click();

............

Here is HTML content for Div tag... ..............

    <div class="logo">
        <img src="/ui/healthcare/assets/images/core/ascension_logo_white.svg" alt="Ascension">
    </div>


    <ul class="list-group">
            <li>
                <h4>Get Involved</h4>
                <ul class="link-list">
                            <li><a href="/Careers">Careers</a></li>
                            <li><a href="/Events">Classes and Events</a></li>

........................

.....enter image description here

enter image description here

1

1 Answers

1
votes

Try this below xpath

 driver.get("https://healthcare.ascension.org/"); 
JavascriptExecutor js = ((JavascriptExecutor) driver); 
js.executeScript("window.scrollTo(0, document.body.scrollHeight)"); 
JavascriptExecutor executor = (JavascriptExecutor) driver; 
executor.executeScript("arguments[0].click();",driver.findElement(By.xpath("//a[@href='/Careers']")));