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 ?

Thanks!

Answers


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.

Update:

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();

Need Your Help

Column static grouping in Matrix

reporting-services grouping

I'm trying to create a technical indicator in Microsoft SSRS. I have a dataset that has a table that tells me whether or not my product has passed various stages in testing and I want to take one of

parsing url in bbcode

php regex parsing url bbcode

Hi I'm developing a custom forum on my website. I would like to convert the urls starting with : http://*.domain.com/photos/{username}/{photo_id} (I should get both username and photo_id ) to the d...