微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

IEauto

 

 
 
  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"; 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐