如何在selenium python中找到script标签中的元素

时间:2015-06-20 17:37:20

标签: javascript python selenium

这是html代码:

<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
  <head></head>
  <body class="- view-form">
    <div id="container"> </div>
    <script type="text/javascript">
      var sub_chart_path = "device";
      var is_dependency = false;
      var max_zoom_factor = 5;
      var image_name_base = "NHCTCC01";
    </script>
   </body>
 </html>

我想要的是在<script type="text/javascript">内找到元素。
有人能告诉我它是如何定位的吗?

1 个答案:

答案 0 :(得分:1)

您需要将select top(@topParam) student.ID , avg(cast(examines.grades as float)) as avg_grade from examines join student on examines.stID = student.stID where (examines.grades > 1) group by student.ID order by avg_grade desc 与Javascript执行者一起使用并获取变量

execute_script
  

应该打印:   设备