Вопрос

I have been trying to test for visibility of WebElements after executing some javascript. The WebElements are found by the following xpaths:

 public static final String MOBILE_APPS_RUNNING_APP_XPATH = "//*[@id='app_slider']/ul/li[1]/a[@class='app nike-running']";
 public static final String MOBILE_APPS_FUELBAND_APP_XPATH = "//*[@id='app_slider']/ul/li[1]/a[@class='app nike-fuelband']";
 public static final String MOBILE_APPS_BASKETBALL_APP_XPATH = "//*[@id='app_slider']/ul/li[1]/a[@class='app nike-basketball']";
 public static final String MOBILE_APPS_TRAINING_APP_XPATH = "//*[@id='app_slider']/ul/li[2]/a[@class='app nike-training']";
 public static final String MOBILE_APPS_KINECT_APP_XPATH = "//*[@id='app_slider']/ul/li[2]/a[@class='app nike-kinect']";
 public static final String MOBILE_APPS_MORE_APPS_XPATH = "//*[@id='app_slider']/ul/li[2]/a[@class='app nike-more']";

The first three elements are visible when the page loads. A javascript function causes the elements to shift via the -moz-transform: translate3d(-1084px, 0px, 0px); style attribute, so that the next three elements become visible. This works well with a local Firefox browser, which picks up the changes, but when I try to use a RemoteWebDriver attached to a Firefox browser in a grid setting, the elements are no longer visible. I have verified with a screenshot that the elements are still visible in the RemoteWebDriver, but I suspect the elements are being cached by the RemoteWebDriver, rather than taken from the updated DOM.

Is there a way to verify this, and if so, how can I refresh the DOM so that I can see the elements are now visible?

To clarify: I use the driver.findElement(By.xpath(...)) method after the javascript executes, and I wait for the element to become visible, which it never does.

Это было полезно?

Решение

It turns out that the versions of selenium-server (and FirefoxDriver) were different between my local machine and the grid, even though the version of Firefox was consistent between the two environments. On my local machine (which worked as intended) I was using selenium-server_2.25.0, while the grid was using selenium-server_2.28.0 (which did not work as intended). One of the differences which had an effect was the change in FirefoxDriver to use Firefox native events. I verified that an update to selenium-server_2.31.0 restored the functionality (and visibility) as intended.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top