Selenium 2 + phantom js: unable to perform actions on a mouseover
I'm trying to perform an action on a button it's never done.
final Actions action = new Actions(mDriver); final WebElement myCart = mDriver.findElement(By.cssSelector("path to my span"]")); final WebElement myButton = mDriver.findElement(By.cssSelector("path to my button")); action.moveToElement(myCart).build().perform(); action.moveToElement(myButton).click().build().perform();
This code works perfectly with firefox but not with phantom JS
I found some issue here How to handle Mouseover in Selenium 2 API or How to perform mouseover function in Selenium WebDriver using Java? but nothing work with phantom.
Is there any known workaround for this ?
I had similar issues when I used GhostDriver and PhantomJS around a year ago (FYI article). Actually I had problems with IE_Driver and Chrome_Driver too, mostly related with visibility of elements outside the screen_frame (page must be scrolled down).
One of most serious issues was the upload_window and handle it through already-mentioned. I wasn't able to achieve it doh. But my workaround was to switch/cast the driver on these problematic places and after they complete/handle the operation - switch it back to GhostDriver. Even by doing so, the execution speed was impressive.
Hope this helps - even late given.
find IWebElement to process set WebDriver from GhostDriver to FirefoxDriver process the IWebElement item with current WebDriver as FirefoxDriver verify expected result from processing the IWebElement item set back WebDriver from FirefoxDriver to GhostDriver continue workflow
As far as I remember my Test framework implementation - a BaseTest class takes care of initialization of used WebDriver and ISelenium objects. So for your more specific case, you can try this:
// Create a new instance of the Ghost driver // Notice that the remainder of the code relies on the interface, // not the implementation. WebDriver driver = new GhostDriver(); //do stuff until new driver is needed driver = new FirefoxDriver(); //do stuff with new driver //'cast' back after required operations have been completed and verified driver = new GhostDriver();