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
本文讨论了如何在Watir脚本中,在检查了弹窗中的复选框后,执行一个用于将所选对象添加到父窗口的JavaScript函数。遇到的问题及解决方案包括使用`fireEvent`方法代替手动调用`execScript`来触发事件。
127

被折叠的 条评论
为什么被折叠?



