zoukankan      html  css  js  c++  java
  • Watir: 很久以前,对Watir开始学习时候做的笔记

    1). buttons Xpath
    1)Button properties
    browser.button(:xpath,"//input[@id='b2']/").name
    browser.button(:xpath,"//input[@id='b2']/").id
    browser.button(:xpath,"//input[@id='b2']/").type
    2)
    browser.button(:xpath,"//input[@value='Click Me']/").click
    browser.button(:xpath,"//input[@value='Submit']/").exists?
    browser.button(:xpath,"//input[@name='missingname']/")
    browser.button(:xpath,"//input[@id='b5']/").enabled?
     
    button(:caption,"Submit").exists?
     
    2. checkbox properties
    browser.checkbox(:index,1).name
    browser.checkbox(:index,1).id
    browser.checkbox(:index,1).type
    browser.checkbox(:index,1).value
    browser.checkbox(:index,1).disabled
     
    browser.checkbox(:name,"box1").class_name
    browser.checkbox(:name,"box4").value
     browser.checkbox(:name,"box4", 5).title
     
    browser.button(:value,"foo").enabled?
    browser.checkbox(:name,"box5").set
    browser.checkbox(:name,"box5").clear
    browser.checkbox(:name,"box1").exists?
     
    browser.checkbox(:name,"box4", 1).exists?
    browser.checkbox(:name,"box4", /[0-9]/).exists?
     
    browser.checkbox(:name,"box1").isSet?
    browser.checkbox(:name,"box1").getState
     
    browser.checkbox(:name,"box1").set( false )
     browser.checkbox(:name,"box1").set( true )
     
    tag_method:test_checkbox_access_by_ole_object, :fails_on_firefox
     def test_checkbox_access_by_ole_object
       ole = browser.checkboxes[1].locate
       browser.checkbox(:ole_object, ole).flash
     end
     
     
    browser.checkbox(:xpath, "//input[@name='box4']/")
    browser.checkbox(:xpath, "//input[@name='box4' and @value='3']/")
     
     
    Div: xpath
    browser.div(:xpath,"//div[text()='Add' and @class='ButtonText']").text
    browser.div(:xpath,"//div[contains(.,'Add') and @class='ButtonText']").text
     
    browser.div(:id,"div77").click
    browser.div(:title,"div77").text
    browser.div(:id, "div77").class_name
    browser.div(:index,2).value
    browser.div(:index,2).name
    browser.div(:index,2).id
    browser.div(:index,2).disabled
     
    browser.div(:xpath, "//div[@id='div77']/").click
    browser.div(:xpath, "//div[@id='div3']/").click
     
     
    Filefield
    browser.file_field(:name,"file1").exists?
    browser.file_field(:id,"file2").exists?
    browser.file_field(:name,"file1").set(file)
    browser.file_field(:name,"file1").value
     
    browser.file_field(:xpath,"//input[@name='file1']/").exists?
    browser.file_field(:xpath,"//input[@id='file2']/").exists?
     
    Form
    browser.form(:name,"test2").exists?
    browser.form(:index,1).exists?
    browser.form(:method,"get").exists?
    browser.form("test2").exists?
    browser.form(:action,"pass.html").exists?
    browser.form(:name,'test2').html
     
    browser.showForms
     
    browser.button(:alt,"submit").exists?
    browser.button(:src,/button/).exists?
     
     
    Frame
    #with ruby's instance_eval, we are able to use the same frame for severalactions
    results= browser.frame("buttonFrame").instance_eval do [
         button(:id, "b2").enabled?,
         button(:caption, "Disabled Button").enabled?
         ]
       end
        assert_equal([true,false], results)
  • 相关阅读:
    第三届NSCTF之easy ssrf
    第三届NSCTF测试题Welcome
    第三届NSCTF测试题Code php 之MD5碰撞和php strcmp函数绕过
    PUT方法提交message
    使用John the Ripper破解sha512加密的shadow文件密码
    第2章 SQL注入攻击:课时1:注入攻击原理及自己编写一个注入点
    配置IIS10支持php语言脚本
    身边的base64解码工具
    什么是JWT
    IDEA 远程调试
  • 原文地址:https://www.cnblogs.com/autotest/p/3262399.html
Copyright © 2011-2022 走看看