- #加载库
- use Win32::IEAutomation;
- use Win32::IEAutomation::WinClicker;
- use Win32::IEAutomation::Element;
- my $ie = Win32::IEAutomation->new(visible =>1);
- #浏览网站
- $ie -> gotoURL('http://130.1.1.1/sdg001.htm?ruijie_query_id=sdg&');
- $ie -> WaitforDone();
- #获取select对象,选择test1
- $ie -> getSelectList("name:",'command') -> SelectItem('test1');
- # IE 6
- use Win32::GuiTest qw(:ALL);
- Gui_Set_ForegroundWindow("Internet Explorer");
- my @windows = FindWindowLike(0,"Microsoft Internet Explorer");
- SetForegroundWindow($windows[0]);
- for(1..3){
- SendKeys("{TAB}");
- }
- SendKeys("{ENTER}");
- SendKeys("{ENTER}");
- $ie -> closeIE();
- #删除ie 进程
- system "taskkill /f /im IEXPLORE.EXE";
- # #
- ## IE 8
- use Win32::GuiTest qw(:ALL);
- Gui_Set_ForegroundWindow("Internet Explorer");
- my @windows = FindWindowLike(0,"Microsoft Internet Explorer");
- SetForegroundWindow($windows[0]);
- for(1..8){
- SendKeys("{TAB}");
- }
- foreach(1..4){
- SendKeys("{ENTER}");
- }
- $ie -> closeIE();
- #删除ie 进程
- system "taskkill /f /im IEXPLORE.EXE";
转载于:https://blog.51cto.com/624569/409347