N多软件可以搞定win runner,load runner,QTP

解决方案 »

  1.   

    win runner,load runner,QTP
      

  2.   

    把网址和要执行的脚本写到一个文件里面,然后软件自动一步步,Navigate 然后算了,复制一段给你吧 void CMyDlg::OnDocumentCompleteExplorer1(LPDISPATCH pDisp, VARIANT FAR* URL) 
    {
    // TODO: Add your control notification handler code here
    try{
    if(CanGo&&list)
    {
    if (glpDisp && glpDisp == pDisp)
    {
    IHTMLWindow2 *pw=NULL;
    IHTMLDocument2 *ph=(IHTMLDocument2*)m_e.GetDocument();
    ph->get_parentWindow(&pw);
    VARIANT ret;
    IHTMLElement* pe=NULL;
    ph->get_body(&pe);
    if(pe!=NULL)
    {

    BSTR bstr;

    pe->get_innerHTML(&bstr);
    CString str=bstr;
    if(e1==0)
    {
    if(str.Find("playerusername")!=-1)
    {
    e1++;
    switch(list->type)
    {
    case 1:
    //3
    if(list->i.size()>0)
    {

    pw->execScript(CComBSTR("document.all.playerusername.value="+list->tel),CComBSTR("javascript"),&ret);
    pw->execScript(CComBSTR("document.all.replayerusername.value="+list->tel),CComBSTR("javascript"),&ret);
    pw->execScript(CComBSTR("document.all.BuyNumber.value="+list->i[0]),CComBSTR("javascript"),&ret);
    pw->execScript(CComBSTR("document.all.form.submit()"),CComBSTR("javascript"),&ret);
    }
    else
    {
    SetEvent(ev);
    }

    break;
    case 2: 
                                                                 .................
      

  3.   

    load runner是三个推荐软件里最好的 最方便的自测效率最高
      

  4.   

    Load runner,可以实现你要的功能,我们的测试就用的这个
      

  5.   

    我的C#代码。用的WebBrowser控件。            HtmlDocument doc = wb.Document;
                if (doc != null)
                {
                    doc.All["txtName"].SetAttribute("value", Helper.getname());
                    doc.All["txtCode"].SetAttribute("value", Card.GetID( Card.CreateID()));
                    doc.Forms["fm1"].SetAttribute("target", "_top");
                    //doc.Forms["fm1"].ScrollIntoView(false);
                    HTMLDocument html = (HTMLDocument)doc.DomDocument;
                    IHTMLWindow2 win = html.parentWindow;
                    string js = "document.all.Submit2.scrollIntoView(false);";
                    win.execScript(js, "javascript");
                    doc.All["codestr"].Focus();
                    //index++;
                }
      

  6.   

    AUTOHOTKEY,非常小巧,也支持脚本语言,我们的C/S软件就用这个做的测试
      

  7.   

    const config_    = "config.ini" '配置文件名称
    const ForReading = 1
    const ForWriting = 2Dim fso,Ieo,Control_Mark
    Set fso = CreateObject("Scripting.FileSystemObject")'WScript.Echo ReadConfig
    RegExpConfig()Function ReadConfig()
        If (fso.FileExists(config_)) Then
            Set Readobj=fso.OpenTextFile(config_,ForReading)
            ReadConfig = Readobj.ReadAll
            Set readobj=Nothing
        Else
        WScript.Timeout = 10
        WScript.Echo "为了正常启动在当前目录下需要配置文件(" & config_ & ")"
        WScript.Quit
        End If
    End FunctionFunction RegExpConfig() 'ReadTextStream
        Set RegTmp1        = New RegExp
        RegTmp1.Global     = True
        RegTmp1.IgnoreCase = True
        RegTmp1.Pattern    = "P(\d{3})=(\S+)\s(\S+)\s(\S+)"
        Set RegSet         = RegTmp1.Execute(ReadConfig())
        For Each Match In RegSet
            Webbrowser Match.SubMatches(0),Match.SubMatches(1),Match.SubMatches(2),Match.SubMatches(3)
            'WScript.Echo match.value
            'Wscript.Echo Match.SubMatches(0) & Match.SubMatches(1) & Match.SubMatches(2)
            '根据子集数目列出数组 子集括号数-1
            'For Each substr in match.submatches
            '    WScript.Echo substr
            'Next
            '枚举
        Next
    End FunctionFunction Webbrowser(Listnum_,Address_,UserName_,PassWord_)
        'WScript.Echo "Address:" & Address_ & " UserName:" & UserName_ & " Password:" &PassWord_
        Control_Mark = True
        Set Ieo = WScript.CreateObject("InternetExplorer.Application","Event_")
        Ieo.Navigate (Address_)
        While (Ieo.Busy)
            WScript.Sleep 200
        Wend
        Ieo.Visible=1
        '登陆行为
        Ieo.Document.All.wd.Value=" UserName:" & UserName_ & " Password:" &PassWord_
        Ieo.Document.All.sb.click
        '执行页面脚本行为
        'Ieo.Document.parentWindow.ExecScript("fun_name();","javascript")
        '等待窗口关闭
        While Control_Mark
            WScript.Sleep 200
        Wend
        'WScript.Echo Listnum_ & "已完成操作"    
    End FunctionSub Event_OnQuit()
    Set Ieo      = Nothing
    Control_Mark = False
    'WScript.Echo 当前IE实例已释放"
    End Sub'''''''''''''''''''''''''config_示例'''''''
    '[Server]
    'P001=www.baidu.com admin1 123456a
    'P002=www.baidu.com admin2 123456b
    'P003=www.baidu.com admin3 123456c
    ''''''''''''''''''''''''''''''''''''''''''