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)
  • 相关阅读:
    python自动化测试-使用第三方python库技术实现
    JMeter目录结构
    JMeter Http请求之content-type用法
    JMeter生成性能报表-Windows环境和Linux环境
    JMeter4.0 IF Controller
    c++ 初始化列表和构造函数初始化区别
    关于C++ 中 thread 的拷贝构造函数
    函数的参数类型 指针和指针的引用的区别
    window10 vs2013 SIFTGPU
    Qt使用双缓冲绘图时报错:pure virtual method called
  • 原文地址:https://www.cnblogs.com/autotest/p/3262399.html
Copyright © 2011-2022 走看看