悠闲的测试和生活。。。
www.happy4tao.com
Qtp中调用网页中的javascript函数
上一篇 /
下一篇 2010-02-22 21:30:00
/ 个人分类:测试工具
环境:IE6.0,Qtp9.2
Set IE = CreateObject("InternetExplorer.Application")
oIE.Visible = True
oIE.Navigate "http://localhost:8080/index.html"
While oIE.Busy:Wend
Set Doc = oIE.Document
oDoc.parentWindow.execScript. "openwin()"
'oDoc.parentWindow.execScript. "alert("
test")"
可以使用document.parentWindow.execScript. 后接js函数名或者js语句。
其中openwin()是index.html中的js函数
<script. LANGUAGE="JavaScript" TYPE="text/javascript">
function openwin()
{
alert("test");
}
</script>
收藏
举报
TAG: