1.   
  2.  
  3. #加载库 
  4.    use Win32::IEAutomation; 
  5.    use Win32::IEAutomation::WinClicker; 
  6.    use Win32::IEAutomation::Element; 
  7.    my $ie = Win32::IEAutomation->new(visible =>1); 
  8. #浏览网站 
  9.    $ie -> gotoURL('http://130.1.1.1/sdg001.htm?ruijie_query_id=sdg&'); 
  10.    $ie -> WaitforDone(); 
  11. #获取select对象,选择test1 
  12.    $ie -> getSelectList("name:",'command') -> SelectItem('test1'); 
  13.   
  14.   
  15. # IE 6 
  16.   use Win32::GuiTest qw(:ALL); 
  17.    Gui_Set_ForegroundWindow("Internet Explorer"); 
  18.    my @windows = FindWindowLike(0,"Microsoft Internet Explorer"); 
  19.    SetForegroundWindow($windows[0]); 
  20.    for(1..3){ 
  21.       SendKeys("{TAB}"); 
  22.    } 
  23.    SendKeys("{ENTER}"); 
  24.    SendKeys("{ENTER}"); 
  25.    $ie -> closeIE(); 
  26.    #删除ie 进程 
  27.     system "taskkill /f /im IEXPLORE.EXE"; 
  28. # #  
  29. ## IE 8 
  30. use Win32::GuiTest qw(:ALL); 
  31.    Gui_Set_ForegroundWindow("Internet Explorer"); 
  32.    my @windows = FindWindowLike(0,"Microsoft Internet Explorer"); 
  33.    SetForegroundWindow($windows[0]); 
  34.    for(1..8){ 
  35.       SendKeys("{TAB}"); 
  36.    } 
  37. foreach(1..4){ 
  38.    SendKeys("{ENTER}"); 
  39.     
  40.   
  41.    $ie -> closeIE(); 
  42.    #删除ie 进程 
  43.     system "taskkill /f /im IEXPLORE.EXE";