主函数 : frmMain.cs
事件的处理的函数 : WatinScript.cs
参数配置函数 : AppSettings.cs
生成脚本的接口函数 : CodeGenerator.cs
生成脚本的具体函数 : 封装在 Formatters 中
获取 Web 页面函数 : WebPage.cs
线程函数接口 : RunThreaded.cs
Excel 格式处理函数 : ExcelWriter.cs , ExcelReader.cs
列表封装函数 : ActionList.cs
具体的动作 : 封装在 actons 中各子类中,基类为 ActionsBase
address 接受键盘 keyup 事件,调用方法名 comboURL_KeyUp( 在 frmMain.cs 中 ) ,调用方法 NavToUrl( string sUrl) , NavToUrl 调用 (CurWB .Navigate (sUrl )) ,下载网页到 csEXWB 控件,调用 (wscript .AddNavigation (watinie , sUrl , "" , "" )) , AddNavigation 函数调用记录操作的接口函数 AddAction
根据是否录制 (Recording, ShouldInsertActions) 标识判断是否将操作加入列表 (ActiveTest) ,
private void comboURL_KeyUp (object sender , KeyEventArgs e )
{
try
{
if (e .KeyCode == Keys .Return )
{
e .Handled = true ;
NavToUrl (comboURL .Text );
// wscript.SaveXML("e://test.xml");
}
else if (e .Control && e .KeyCode == Keys .V )
{
e .Handled = true ;
comboURL .Text = Clipboard .GetText ();
NavToUrl (Clipboard .GetText ());
cEXWB1 .Focus ();
}
else if (e .Control && e .KeyCode == Keys .C )
{
Clipboard .SetText (comboURL .Text );
}
}
catch (Exception eex )
{
MessageBox .Show (eex .Message , "comboUrl_KeyUp" );
}
}
public void NavToUrl (string sUrl )
{
if (!CheckWBPointer ())
return ;
try
{
CurWB .Navigate (sUrl );
wscript .AddNavigation (watinie , sUrl , "" , "" );
}
catch (Exception ee )
{
AllForms .FrmLog .AppendToLog ("NavToUrl/r/n" + ee );
}
}
public void AddNavigation (BrowserWindow browser , string url , string username , string password )
{
var nav = new ActionNavigate
{
ParentPage = browser .DeterminePage ();
URL = url ;
Username = username ;
Password = password;
};
if (WebPageList .FindByHash (nav .ParentPage .HashCode )==null )
{
WebPageList .Add (nav .ParentPage );
}
// if the username is not blank , replace a navigation action just prior in the list
if (username != "" && ActiveTest .Count > 0)
{
ActiveTest .RemoveAt (ActiveTest .Count - 1);
}
AddAction (nav );
}
public void AddAction (ActionBase action )
{
if (!Recording ) return ;
if (ShouldInsertActions )
{
InsertAction (InsertPosition , action );
InsertPosition ++;
return ;
}
ActiveTest .Add (action );
ActiveTest .UnsavedScript = true ;
action .ParentTest = ActiveTest ;
if (MainBrowser .OnGridAdd != null ) MainBrowser .OnGridAdd (action );
}
search 接受键盘 keyup 事件,调用方法名 comboSearch_KeyUp( object sender , KeyEventArgs e) , 格式化字符串 str ,调用方法 NavToUrl( string str) ,后面的流程同 address 接受的事件
private void comboSearch_KeyUp (object sender , KeyEventArgs e )
{
if (e .KeyCode == Keys .Enter )
{
e .Handled = true ;
if (comboSearch .Text .Length == 0)
return ;
string str = comboSearch .Text .Replace (" " , "+" );
str = string .Format (Properties .Resources .SearchURL , str );
NavToUrl (str );
}
}
处理控件中的 CommandStateChange 事件
处理控件中的 DocumentComplete 事件
处理控件中的 DownloadBegin 事件
处理控件中的 DownloadComplete 事件
处理控件中的 FileDownload 事件
处理控件中的 NewWindow2 事件
处理控件中的 NewWindow3 事件
处理控件中的 ProgressChange 事件
处理控件中的 RefreshBegin 事件
处理控件中的 RefreshEnd 事件
处理控件中的 ScriptError 事件
处理控件中的 SetSecureLockIcon 事件
处理控件中的 StatusTextChange 事件
处理控件中的 TitleChange 事件
处理控件中的 WBAuthenticate 事件
处理控件中的 WBDocHostShowUIShowMessage 事件
处理控件中,拖动事件