kurri
kurri

Reputation: 57

How to Click Sub Menu Link in Main Menu

I am trying to Click on Sub Menu. But it is not allowing to me Click and disappearing. In Console it is showing :

Element Not Visible exception.

Here is HTML Code :

<a href="/web/billing/storageHandlingRate">
    <img class="navIcon" src="/web/images/nav/subChargeRuleMaintenance.png"/>
    Storage Handling Rate
</a>

Xpath I am using :

xpath(".//*[@id='globalMenuNavigation']/li[2]/ul/li[7]/a")

Upvotes: 0

Views: 155

Answers (1)

Saurabh Gaur
Saurabh Gaur

Reputation: 23805

You should try using WebDriverWait to wait until element visible and clickable as below :-

new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.xpath(".//a[contains(.,'Storage Handling Rate')]"))).click();

Or

new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.partialLinkText("Storage Handling Rate"))).click();

Upvotes: 1

Related Questions