Watir学习笔记之一 浏览器的简单使用
来源:互联网 发布:linux ubuntu iso下载 编辑:程序博客网 时间:2024/05/21 09:46
Load the Watir libraryrequire 'watir' Open a browser (default: Internet Explorer)browser = Watir::Browser.new Open Browser at the specified URL browser = Watir::Browser.start("http://google.com")
Go to a specified URL browser.goto("http://amazon.com")
Close the browserbrowser.close
Browser options (IE only)Speed up execution(or use the "-b" command line switch)browser.speed = :fast Maximize browser windowbrowser.maximize
Pop browser window to frontbrowser.bring_to_front Access an ElementText box or text area
t = browser.text_field(:name, "username")
Buttonb = browser.button(:value, "Click Here")
Drop down list
d = browser.select_list(:name, "month") Check box
c = browser.checkbox(:name, "enabled")
Radio buttonr = browser.radio(:name, "payment type")
Formf = browser.form(:name, "address")f = browser.form(:action, "submit")
Linkl = browser.link(:url, "http://google.com")l = browser.link(:href, "http://google.com")
Table cell in a table (2nd row, 1st column)
td = browser.table(:name, 'recent_records')[2][1] Manipulate the ElementClick a button or linkb.clickl.click Enter text in a text boxt.set("mickey mouse") Enter multiple lines in a multi-line text boxt.set("line 1/nline2") Set radio button or check boxc.setr.set Clear an elementt.clearc.clearr.clear Select an option in a drop down listd.select "cash"d.set "cash" Clear a drop down listd.clearSelection Submit a formf.submit Flash any element (useful from the watir-console)e.flash Check the ContentsReturn the html of the page or any elementbrowser.htmle.html Return the text of the page or any elementbrowser.texte.text Return the title of the documentbrowser.title Get text from status bar.browser.status=> "Done" Return true if the specified text appears on the pagebrowser.text.include? 'llama' Return the contents of a table as an arraybrowser.table(:id, 'recent_records').to_a
- Watir学习笔记之一 浏览器的简单使用
- watir学习笔记/ruby
- Django搭建简单网页的学习笔记 之一(models)
- 浏览器的简单使用
- Android编程学习之一:简单的控件使用
- watir&webdriver初学的笔记(更新)
- 针对popups类对话框的watir处理方法之一
- 乙醇的watir-webdriver系列视频第1讲 学习笔记
- 【OpenCV学习笔记】之一: reduce() 和 findContours()的使用陷阱
- 图片浏览器学习之一
- 使用watir操作ie控件的方法
- SOA的学习笔记之一
- Rhino学习笔记(二)---简单的使用
- Android学习笔记 EditText的简单使用
- Yii学习笔记--简单的使用
- 【学习笔记】 FancyCoverFlow的简单使用
- [学习笔记]Xcode的简单使用
- 学习笔记:WKWebView的简单使用(Swift)
- Ubuntu 3D桌面特效的详细设置
- 一、Qt Creator的安装和hello world程序的编写
- 复制互联网2010全球最值得模仿的230个网站
- Hibernate 之many-to-one 单向多对一关联示例
- Peppermint Linux云特征体验
- Watir学习笔记之一 浏览器的简单使用
- Jersey 非 web 方式 发布服务
- 二、Qt Creator编写多窗口程序
- 三、Qt Creator登录对话框
- Dynamic Proxy、 Proxy Pattern and Decorator Pattern
- 利用JAVA获取远程文件及断点续传
- 你快乐吗
- WinCE中文件的路径
- MySQL Connector/Net 6.3.3 Beta 发布