我一直在使用watin进行been应用程序的集成测试。webapp使用fckeditor作为富文本控件之一。
下面是我的webapp的viewsource的html片段,其中包含fckeditor
iframe id="ctl00_HeaderMain_txtSafetyNetDescription___Frame“src="/FCKEditor/editor/fckeditor.html?InstanceName=ctl00_HeaderMain_txtSafetyNetDescription&Toolbar=myApp”width="100%“height="200px”frameborder="no“scrolling="no”/iframe
通过使用watin脚本...我可以用下面的代码获得frame对象。
Frame frame = ie.Frame(Find.ById("ctl00_HeaderMain_txtSafetyNetDescription___Frame")) ;现在,我想向fckeditor写入一些文本。但是我不确定如何写给fckeditor,因为它是一个框架--有人能在这方面帮我吗?
谢谢。艾扬格。
发布于 2011-04-02 16:13:03
它能帮到你~
Frame frame = ie.Frame("blogBody-EditingArea");
frame.ElementWithTag("body",Find.Any).SetAttributeValue("innerText",“DateTime.Now”+现在的心情记录);
发布于 2009-10-13 16:00:04
在firefox的帮助下,我可以找到fckeditor的watin测试脚本的解决方案。谢谢,FireFox。使用fck编辑器,框架内有一个框架。Ie公开内部框架,但不公开框架内部frame。
其中,as FireFox清楚地显示了dom树。
Watin不允许更新para的innerhtml。但是,它公开了一个名为RunScript的方法。我们可以为对象编写一个JS并执行它。在这种情况下,它是子帧。这就解决了这个问题
Frame frame = ie.Frame(Find.ById("ctl00_HeaderMain_txtSafetyNetDescription___Frame"));Frame ChildFrame = frame.Frame(Find.BySrc("javascript:void(0)"));Para para = ChildFrame.Para(Find.ByIndex(0));
// fck editr不对参数进行id -因此需要提供id值(“id”,"fckpara");字符串fckvalue = "Myfckeditor para.SetAttributeValue ";字符串js =“”;js = js +“document.getElementById('fckpara').innerHTML = '”+ fckvalue + "‘;";
ChildFrame.RunScript(js);我很激动。谢谢大家。
伊耶格纳。
https://stackoverflow.com/questions/1540236
复制相似问题