user1732506
user1732506

Reputation: 21

Capturing text from href

<h1 class="currentStatusUserName">
<a href="/_ui/core/userprofile/UserProfilePage">Apttus 0614CommSalesRep1</a>

I'm trying to capture into a variable Apttus 0614CommSalesRep1 but I'm not successful with the following

salesUser = driver.findElement(By.xpath(
        "//a[@href='/_ui/core/userprofile/UserProfilePage']"))
    .getText();

Upvotes: 0

Views: 39

Answers (1)

MivaScott
MivaScott

Reputation: 1806

Alternate methods for .getText()

driver.findElement(By.xpath("")).getAttribute("innerHTML");
driver.findElement(By.xpath("")).getAttribute("textContent");

Upvotes: 1

Related Questions