Pinakee
Pinakee

Reputation: 5

How to click on left side menu item

I am facing issue clicking on a left menu item (Menu Item name in page displays as "Mailbox Send"). HTML looks like below.

<tr>
    <td></td>
    <td width="150" align="left" class="navcolor" height="22"><b><a class="WhiteNavLink" href="http://ttgllpgisapp02:5000/mailbox/jsp/MBISend.jsp?securetoken=1461807919764oodj56n5jdvg1rekn7iz154io" target="view_body">&nbsp;&nbsp;Mailbox Send&nbsp;&nbsp;</a></b></td>
</tr>

I tried using xpath but it didn't worked, xpath looks like :

/html/body/form/table/tbody/tr/td/table[3]/tbody/tr[4]/td[2]/b/a

Please help me with some idea how to click on the element.

Upvotes: 0

Views: 1745

Answers (1)

alecxe
alecxe

Reputation: 474231

Assuming you are using selenium, I would actually use a "by link text" locator here.

Example in Java:

driver.findElement(By.partialLinkText("Mailbox Send")).click();

As for the XPath, you can still get it by text, but, first, you need to normalize space:

//a[normalize-space(.) = "Mailbox Send"]

Upvotes: 1

Related Questions