0

I would like to move stars with Selenium on this page:

http://www.html5canvastutorials.com/demos/labs/html5_canvas_elastic_stars/

They are on html canvas. So if I try to inspect element, I only see canvas tag.

Is it possible to do this with selenium and if yes, how?

4

1 回答 1

1

好吧,问题是 selenium 通常与可以在 HTML 树模型中找到的 WebElements 交互(即使用 xPaths 或 css 选择器)。

在您的情况下,我们只有画布,这些星星是由 js 以随机方式生成的。请参阅下面的屏幕

在此处输入图像描述

所以问题是定位这些星星。如果可能(获取星星的位置),我们可以使用Action Builder API 或某种机器人 API(机器人框架)与这些星星进行交互。

在我看来,用 selenium 自动化这个非常困难(因为随机星位生成)。问候。

于 2012-10-15T12:06:10.733 回答