`
lilingjay
  • 浏览: 8155 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

Watir: How can I execute in a watir script a specific javascript function called

 
阅读更多

原地址 http://stackoverflow.com/questions/6051786/watir-how-can-i-execute-in-a-watir-script-a-specific-javascript-function-called

 

Question

 

 

In a Watir script, after I check checkboxes in a popup window, I'm trying to execute a javascript function to add objects selected to the parent window.

What works fine until now it is the check of the checkbox, but object is not added to the parent window and I get following error when I executed the watir script: in `method_missing': execScript (WIN32OLERuntimeError)

This was my approach - please let me know what other method I can use

ie.checkbox(:id => "check_asm0option0").set 
ie.document.parentWindow.execScript("window.triggerOriginalChange(asm0option0, add);","JavaScript") 

tr class="tr_option" rel="asm0option0"
td class="td_check"
input id="check_asm0option0" type="checkbox" value="4dbb118ddca3244e2800003d" rel="asm0option0" name="ignore"
/td
td class="td_li"
li value="0" rel="asm0option0" test /li
/td
/tr


if using .set doesn't result in your code working the way you'd expect, then examine the source and then try using .fireEvent to fire the event that should trigger the script that needs to execute.

In this case I'd try

ie.checkbox(:id => "check_asm0option0").fireEvent('onChange')

that approach is generally a bit more organic and easier than trying to invoke the script manually

分享到:
评论

相关推荐

    ruby and watir 安装指南

    It ran successfully once, but now when I say b=Watir::Browser.new, it produces a NoMethodError for a method 'demodulize'. I tried some stuff around and when I said require 'firewatir/firefox' , the ...

    watir:由Selenium驱动的Watir

    使用Watir 本自述文件供有兴趣在Watir生态系统中利用私有API Watir代码编写Watir或gem的代码的人使用。 对于我们的用户,您需要的一切都在:示例,新闻,指南,其他资源,支持信息等。补丁/请求请求的过程分叉该项目...

    watir-rails:添加对Watir(http

    安装将此代码添加到您的Gemfile中: group :test do gem "watir-rails"end用法就像您在请求/集成测试中一如既往地使用Watir: browser = Watir :: Browser . newbrowser . goto home_pathbrowser . text_field ( ...

    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测试框架介绍 watir测试框架介绍

    watir安装包之三 IE watir

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

    Watir1.6.5(commonwatir+firewatir+watir)+Ruby186-26

    Ruby+Watir:开源轻量级、基于Ruby语言、Web应用的自动化测试框架。

    watirsome:Watir很棒的页面对象

    烦人的 纯动态的基于Watir的页面对象DSL...对于每个元素,都定义了访问器方法,该方法返回Watir::Element实例(或子类型,如果适用)。 元素访问器方法名称为#{element_name}_#{tag_name} 。 class Page include Wat

    watir网页模式的自动化功能测试工具

    Watir:开源轻量级、基于Ruby语言、Web应用的自动化测试框架。

    heroku_ruby_cucumber_watir:Cumber自动化测试

    在这里,我们可以找到使用Ruby编程语言进行的自动化测试,并在页面上实现了Cucumber和watir jemas。

    domkey:Selenium Watir Webdriver 的域特定页面组件

    组件出现在一个容器中,默认情况下它是一个 Watir::Browser,但可以是任何 Watir::Element 或一个组件。 组件位于 View 类中,该类为页面范围建模,浏览器中的容器。 创建一个视图对象并包含 Domkey::View。 现在您...

    watir语法详解和描述

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

    watir介绍及安装

    watir介绍及安装

    Watir测试框架介绍

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

    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参考手册

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

    watir简易教程

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

    Watir的介绍文档:基于RUBY的web UI自动化测试库

    Watir 是一个使用 Ruby 实现的开源Web 自动化测试框架,相对于那些庞大的商业工具来说,它很小巧,也很灵活,提供的功能也足够用。 它支持当前流行的浏览器。 它是免费的开源库,而且使用起来非常的方便。

    watir Web自动化测试框架 api

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

Global site tag (gtag.js) - Google Analytics