如何从WatiN触发JQuery选择器 [英] How to fire a JQuery selector from WatiN

查看:64
本文介绍了如何从WatiN触发JQuery选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用watin测试网页.其中绝大多数工作正常.但是我有一个使用JQuery运行的函数.当SelectList的选项更改时.当我运行浏览器并且在js代码中有一个断点时,将触发以下jquery选择器.

I am using watin to test a web page. The vast majority of which works fine. But I have a function that is run using JQuery. When the option of a SelectList is changed. When I run the browser and I have a break point in the js code the following jquery selector is fired.

$(#OwningRegion").change(function(){

$("#OwningRegion").change(function () {

但是我不能使这种情况发生在watin中.我已经尝试过FireEvent("change").我已经尝试过FireEvent("onClick").我已经尝试过.Option [1] .Click().等

But I cannot cause this to happen with watin. I have tried the FireEvent("change"). I have tried FireEvent("onClick"). I have tried .Option[1].Click(). etc.

推荐答案

尝试以下方法:

browser.Eval(string.Format("$('#{0},.{0}').change();", id)); //Both for classes and id's

这篇关于如何从WatiN触发JQuery选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆