2

I am using Intel's html5 app development framework. Particularly, I am using their carousel plugin. But I suspect knowledge of webdriver is more useful here.

The way their carousel works is that the pages float next to each other inside a div which has a limited width and overflow hidden. You can only see one of the pages at a time through the div "viewport".

When you touch to move to the next div, it applies a css transform to animate sliding the page divs past. This works fine. However webdriver has trouble with elements inside the animation div.

When you are on the first page, selenium reports all elements (on both pages) as displayed, even though half of them are hidden. Once you have transitioned to the second page, selenium reports all elements (on both pages) as not displayed.

I tracked it down to this css property that gets applied to the animation div:

-webkit-transform: translate3d(-1024px, 0px, 0);

When this is applied, selenium thinks this element is invisible. When I remove it using Chrome developer tools, it thinks they are all visible.

Two ways you might be able to help me:

  • Can I get selenium to report correctly the visibility of these elements? Perhaps by tweaking the way the carousel works? (It is open source).
  • Can I tell selenium to just click the element anyway, even though it is "not visible"?
Martin Eden
  • 6,143
  • 3
  • 30
  • 33
  • I have also asked Intel about this on their forums (https://forums.html5dev-software.intel.com/viewtopic.php?f=28&t=4111) but it seems like that this is more of a webdriver problem, seeing as the element actually is visible! – Martin Eden Jul 15 '13 at 11:15
  • 1
    This seems to be a recurring problem the Selenium team has been tackling for a long time. See e.g. https://github.com/lightbody/browsermob-proxy#using-with-selenium. Which Selenium version are you using? Try updating it to current 2.33.0, there have been continuous improvements over time. Does it work in any browser, or does it fail in all (FF and Chrome are the main things that should work). – Petr Janeček Jul 15 '13 at 12:32
  • I tried the latest version of selenium. I am using Chrome on Windows 8. I may be able to test in another browser, but I am actually developing a hybrid app targeting webkit, so it's not easy to run in other browers. – Martin Eden Jul 15 '13 at 14:01

2 Answers2

1

This solves the problem, by getting around the bug in selenium.

new Actions(driver).MoveToElement(element).Click().Perform();

Selenium can click on the link using this code. Now I just need to try and get a minimal example to use as a bug report to the maintainers of selenium... tricky.

Martin Eden
  • 6,143
  • 3
  • 30
  • 33
  • Someone edited my answer to use camelCase for the method names. I reverted it back, as this example is in C#, not Java. – Martin Eden Jul 24 '13 at 14:32
0

I've found a tweak for the carousel that seems to work, but it may mess up the behaviour in some way I haven't anticipated. I replaced this line, in moveCSS3

el.style[$.feat.cssPrefix+"Transform"] = "translate" + translateOpen + distanceToMove.x + "px," + distanceToMove.y + "px" + translateClose;

with

el.style["margin-left"] = distanceToMove.x + "px";
el.style["margin-top"] = distanceToMove.y + "px";

which seems to work.

Other answers are welcome. Is this a bug I should report to selenium?

Martin Eden
  • 6,143
  • 3
  • 30
  • 33
  • I have asked the plugin maintainer what they think of this fix here: https://github.com/01org/af-carousel/issues/1 – Martin Eden Jul 15 '13 at 12:20