zoukankan      html  css  js  c++  java
  • wd中使用jquery(转载)

    转载于http://blog.csdn.net/nbkhic/article/details/6897089

    <html>
        <head>
            <title>FireEvent</title>
            <style>
                .mo {color: blue;}
                .tips {display:none;border: 1px solid #ccc; background-color:#EFEFEF; 100px;height:100px}
            </style>
            <script>
                function show_tips(){
                    document.getElementById("t").style.display = "block";
                }
                function hide_tips(){
                    document.getElementById("t").style.display = "none";
                }
            </script>
        </head>
        <body>
            <a class = "mo" href = "#" onmouseover = "show_tips()" onmouseout = "hide_tips()">Mouse Over Here</a>
            <div id = "t" class = "tips">This is the tips of link</div>
        </body>
    </html>
    jquery_helper.rb
     
    #encoding: utf-8
    module JqueryHelper
        def load_jquery dr,jquery_path
            jq = read_jquery(jquery_path)
            jq.force_encoding('utf-8')
            dr.execute_script jq
        end
     
        def read_jquery(jquery_path)
            js = ''
            File.open(File.expand_path(jquery_path), 'r') do |f|
                js = f.read
            end
            js
        end
    end
     
    fire_event.rb
     
    require 'rubygems'
    require 'selenium-webdriver'
    require './jquery_helper'
    include JqueryHelper
    dr = Selenium::WebDriver.for :firefox
    select_file = 'file:///'.concat File.expand_path(File.join(File.dirname(__FILE__), 'fire_event.html'))
    dr.navigate.to select_file
     
    jquery_path = './jquery-1.6.4.min.js'
    load_jquery dr, jquery_path
    jq = <<JQ
        $("#t").show();
    JQ
     
    dr.execute_script jq


  • 相关阅读:
    数据结构与算法
    c++学习笔记
    红黑树(map与unorder_map)B B+树
    数据库笔记
    多路复用IO:select poll epoll
    https加密过程!!! 这才是差不多非常详细的https双方获取共用的秘钥过程!!!!!
    助教周报(第一轮)——范青青
    第二十二周助教总结(2021.6.28-7.4)
    第二十一周助教总结(2021.6.21-6.27)
    第二十周助教总结(2021.6.14-6.20)
  • 原文地址:https://www.cnblogs.com/zhangfei/p/2500834.html
Copyright © 2011-2022 走看看