Currently, I am in the process of writing a selenium C# test script for an older "infragistics" webpage, which I must admit, is not something I am very familiar with. The challenge I am facing is that the page does not provide many options for referencing elements. For example, I want to click on the submenu item called INVENTORY within a menu, but there is no element Id or Name to work with. Therefore, I have resorted to using XPath (see code snippet below). It appears that the webdriver recognizes this XPath, however, when the click function is executed, nothing happens on the page – the expected page fails to open. Is there something I am missing or doing wrong here?
<li class="igdm_MenuItemVertical igdm_MenuItemVerticalParent " unselectable="on" data-ig="x:1171509256.11:adr:1.2" adr="1.2"><A onclick="{return false;}" tabIndex=-1 class="igdm_MenuItemVerticalLink " href="#/Inventory...">
<a onclick="{return false;}" tabIndex=-1 class="igdm_MenuItemVerticalLink>
<img class="igdm_MenuItemVerticalIcon " alt=" Inventory..." src="../Images/report16.gif">
<span tabIndex=-1 unselectable="on"> INVENTORY...</span>
</a>
Test Script:
private By FileSubMenu = By.XPath(".//li/a/span[text()=' Inventory...']");
public HomePage SubMenu()
{
int retryCount = 0;
while (true && retryCount < Constants.RETRY_COUNT)
{
try
{
Thread.Sleep(3000);
IWebElement element = _driver.FindElement(FileSubMenu);
Actions Rmouseover = new Actions(_driver);
Rmouseover.MoveToElement(element).Click().Perform();
return this;
}
catch (Exception ex) when (ex is WebDriverTimeoutException || ex is TimeoutException)
{
retryCount++;
Thread.Sleep(3000);
}
}
return this;
}