`
fireDragonpzy
  • 浏览: 444275 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

watir 火狐浏览器

阅读更多
#coding:gbk

 require 'watir-webdriver'

 b = Watir::Browser.new :firefox
 b.goto 'http://ckeditor.com/demo'

[url]http://17test.info/?page_id=561[/url]

所见即所得编辑器
有两种方法可以通过Watir-WebDriver向所见即所得编辑器(应该指的是富文本编辑器)中输入文字:

定位编辑器所在的iFrame,然后使用.send_keys方法(缺点是浏览器必须在前台运行)
在浏览器上执行javascript,通过js脚本去设置编辑器的值(最可靠的办法)
CKEditor

require 'watir-webdriver'

b = Watir::Browser.new :firefox

b.goto 'http://ckeditor.com/demo'

b.execute_script("CKEDITOR.instances['editor1'].setData('hello world');")

b.frame(:title => 'Rich text editor, editor1, press ALT 0 for help.').send_keys 'hello world again'

TinyMCE Editor

require 'watir-webdriver'

b = Watir::Browser.new

b.goto 'http://tinymce.moxiecode.com/tryit/full.php'

b.execute_script("tinyMCE.get('content').execCommand('mceSetContent',false, 'hello world' );")

b.frame(:id => "content_ifr").send_keys 'hello world again'

One Response to 所见即所得编辑器
铁牛仔 says:
2012/05/13 at 11:02 pm
国产KindEditor:
require “watir-webdriver”
b = Watir::Browser.start “kindsoft.net/ke4/examples/default.html”
b.execute_script(“window.editor.html(‘Hello, KindEditor!!’)”)
Reply
分享到:
评论

相关推荐

    watir测试框架介绍

    watir测试框架介绍 watir测试框架介绍 watir测试框架介绍

    watir-webdriver谷歌浏览器驱动

    ChromeDriver 是一款以 Google Chrome 为环境测试网站的工具,现已实现对开源的 WebDriver 通路协议的支持,因此可以轻松与现有的 WebDriver 测试工具相整合。不熟悉 WebDriver 的用户可以参考 2009 年的项目发布...

    watir安装包之三 IE watir

    安装命令:gem install watir --local。

    ruby and watir 安装指南

    Hi all, I had to rebuild my box and I currently am unable to install Watir. gem install watir ERROR: Error installing watir: activesupport requires Ruby version >= 1.8.7. Which would be fine if ...

    watir语法详解和描述

    watir语法的详细介绍和描述,适合watir初学者。

    watir介绍及安装

    watir介绍及安装

    Watir测试框架介绍

    Watir测试框架介绍、环境配置、API介绍

    watir-1.5.2.gem

    开源自动化测试工具组合:Ruby+Watir安装 安装准备: 1. 工具安装包准备: Ruby官方下载地址:http://www.ruby-lang.org/zh_cn/downloads/,稳定版本Ruby 1.8.6 Watir下载地址:...

    watir-1.6.5.gem

    开源自动化测试工具组合:Ruby+Watir安装 安装准备: 1. 工具安装包准备: Ruby官方下载地址:http://www.ruby-lang.org/zh_cn/downloads/,稳定版本Ruby 1.8.6 Watir下载地址:...

    自动化测试Watir参考手册

    该文档比较详细地介绍了自动化测试工具watir

    watir-cn中文补丁包

    watir-cn中文语言包 watir-cn中文语言包 watir-cn中文语言包 watir-cn中文语言包 watir-cn中文语言包 watir-cn中文语言包 watir-cn中文语言包 watir-cn中文语言包 watir-cn中文语言包 watir-cn中文语言包 watir-cn...

    Watir自动化测试培训

    公司自动化测试培训ppt,使用语言ruby,自动化测试工具watir,讲解基础api和常用框架

    watir Web自动化测试框架 api

    Watir 是一个使用 Ruby 实现的开源Web 自动化测试框架,相对于那些庞大的商业工具来说,它很小巧,也很灵活,提供的功能也足够用。最近抽时间试用了一下,感觉还不错,准备下一步在公司推广使用。因为 Watir 的网站...

    watir api chm

    watir的api文档,可以离线查阅! chm格式。

    watir简易教程

    Watir全称是“Web Application Testing in Ruby”,发音类似“water”。它是一种基于网页模式的自动化功能测试工具。 Watir是一个Ruby库,使用多版本浏览器进行Web应用程序测试。

    Watir-Webdriver最新安装文件(全)

    压缩包中包含目前2013/01/19最新的安装文件,有rubyinstaller-1.9.2-p136、DevKit-tdm-32-4.5.1-20101214-1400-sfx、rubygems-1.8.24、watir-4.0.2、watir-webdriver-0.6.2等文件,并附上简略安装说明。

    Watir图文教程

    Watir图文教程 ppt材料 全英文 但是很容易看懂

Global site tag (gtag.js) - Google Analytics