I'm really struggling to automate some drag and drop functionality in a web app. All I need to do is click a link on a top menu bar, hold down on it and select the first menu option. It works fine in Chrome but I need it to work in FF. Currently using FF 37 and Selenium 2.45. My code:
driver.switchTo().defaultContent(); driver.switchTo().frame(0); Actions action = new Actions(driver); //click 'Content' button, this will expose the 'New' button WebElement contentDropDownButton = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//*[@id='topPane']/div/div/*//*//*[text()[contains(.,'Content')]]"))); action.moveToElement(contentDropDownButton).clickAndHold(); action.perform(); //capture 'New' in a WebElement and then click and hold on it WebElement newButton = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//*[starts-with(@id, 'fw_dijit_UIPopupMenuItem')][text()[contains(.,'New')]]"))); action.moveToElement(newButton).clickAndHold(); action.perform();
Like I say, works fine in Chrome. What would be the best approach to handling this and can someone suggest code? I don't think I actually need to 'click' or 'hold' on either of the Content or New buttons as a real interation will work with a simple mouse hover. I'm just not sure how to recreate this with webdriver.