Issue with locating element from a drop-down

I have an issue which is probably best highlighted with the attachment here…… http://imgur.com/XTafwFJ

I am basically trying to select the ‘Eclipse Deal Target’ option from the drop-down list.  It’s worth noting that these are pop-out lists that appear when I hover over the dropdowns with the mouse. The code I am using to do this is as below:


public static void eclipseDealTargetsFocus(InternetExplorerDriver driver)

{

genericControls.waitCommands.fluentWaitOnEclipseDealTargets(driver);

driver.findElement(By.xpath("html/body/div[1]/form/div[3]/div/ul/li[4]/ul/li[5]/ul/li[2]/a")).sendKeys(Keys.ENTER);

}

I’ve tried various ways of locating the element, using various xpath locators but I keep getting an exception advising the element cannot be found. I even tried putting a fluent wait in, but this did not rectify it. It’s all the more strange, as I am able to select any of the other options from the drop down list, e.g. CCL report, Eclipse Summary etc.

Any help would be appreciated with this.

Add Comment
  • 1 Answer(s)

    Hi,

    This has nothing to do with wait feature.

    You have to use Actions class for mouseover scenarios.

    webdriver.findElement(By.xpath(“CONTRACT SEARCH Xpath”)).click();
    Actions action = new Actions(webdriver);
    WebElement we = webdriver.findElement(By.xpath(“NEW BUSINESS Xpath”));
    action.moveToElement(we).moveToElement(webdriver.findElement(By.xpath(“ECLIPSE DEAL TARGET xpath”))).click().build().perform();

    Let me know incase you still have issues.

    Regards,
    Rajesh

    Supporter Answered on January 7, 2015.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.