kurri kurri - 3 months ago 6
Javascript Question

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")

Answer

(Assuming you're using Java) 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();
Comments