selenium处理 <a target=_blank 几种方式整理
方法1.取 href ,再用open(当时是为了走通流程) 方法2.修改被测页面的<a> 元素打开页面的方式 方法3:在单击弹出后,用selenium.getAllWindowTitles(),取最后一个title(这个我暂时没有用到,因title都一样)selenium.click(picXpath); String[] titles=selenium.getAllWindowTitles(); selenium.selectWindow("title="+titles[titles.length-1]+""); //add code selenium.close(); 方法4:autoit, 一点点来模拟.(vbs,代码片)Set objArgs = WScript.Arguments Set oAutoIt = CreateObject("AutoItX3.Control") oAutoIt.WinActivate "untitled", "" oAutoIt.WinWaitActive "untitled","",5 oAutoIt.MouseClick "left", objArgs(0), objArgs(1), 1 rem oAutoIt.AutoItSetOption "WinTitleMatchMode", 2 'set title = oAutoIt.WinGetTitle("_更多", "") oAutoIt.WinActivate "_更多", "" oAutoIt.WinWaitActive "_更多", "",5 |