无法单击Flash对象

时间:2017-08-28 13:12:18

标签: javascript selenium flash selenium-webdriver

如何单击框架内的flash对象。 HTML代码如下。

我发现了许多相关主题,但没有一个能解决我的问题。所以我在这里发布我的HTML代码。我是硒的新手所以请耐心等待。



<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>Visualizer Plugin</title>
  <link href="../../plugins/Visualizer/resources/css/mystyle.css" rel="stylesheet" type="text/css">
  <script src="../../plugins/Visualizer/resources/javascript/flex.js" type="text/javascript">
  </script>
  <script src="../../plugins/Visualizer/resources/javascript/PluginSupport.js?server=blt05574004" type="text/javascript">
  </script>
  <script src="../../plugins/Visualizer/resources/javascript/BaseController.js" type="text/javascript">
  </script>
  <script src="../../plugins/Visualizer/resources/javascript/Setup.js" type="text/javascript">
  </script>
  <style type="text/css" media="screen">
    body {
      margin: 0px;
      overflow: hidden
    }
  </style>
</head>

<body scroll="no" style="background-color: transparent;" onload="initSetupScript();">
  <div align="center">
    <div id="flashcontent">
      <object width="100%" height="100%" id="Visualizer" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">
			<param name="allowFullScreen" value="true">
			<param name="align" value="middle">
			<param name="quality" value="high">
			<param name="wmode" value="transparent">
			<param name="allowScriptAccess" value="sameDomain">
			<param name="type" value="application/x-shockwave-flash">
			<param name="src" value="../../plugins/Visualizer/resources/swf/../../plugins/Visualizer/resources/swf/Visualizer.swf?r=7.5.00">
			<param name="flashvars" value="bridgeName=Visualizer">
		</object>
    </div>
  </div>
  <script language="JavaScript" type="text/javascript">
    var src = "../../plugins/Visualizer/resources/swf/Visualizer";
    var id = "Visualizer";
    var uri = "../../plugins/Visualizer/resources/swf/";
    var flashvars = "";
    var release = "7.5.00";
    createSWF(src, id, uri, release, flashvars);
  </script>

</body>

</html>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:1)

所以你需要flashcontent而不是flash。你可以使用XPATH以下

//div[@id='flashcontent']//param[@name='quality']

在xpath之上将返回值quality元素

注意:如果上面的元素位于任何框架下,则需要先将其切换

如果Selenium无法对Flash内容进行操作。您需要使用另一个框架来自动化Flash内容,例如:Sikuli

参考:

http://www.softwaretestinghelp.com/sikuli-tutorial-part-1/

http://www.sikuli.org/testimonials.html

希望它会对你有所帮助。

答案 1 :(得分:0)

Selenium无法对Flash内容进行操作。您需要使用另一个框架来自动化Flash内容,例如Flash testing。有Sikuli(正如其他人提到的那样),还有“Chrome浏览器中的Sikuli”工具Kantu