用 PS 操作 IE
来源:互联网 发布:python图形界面 编辑:程序博客网 时间:2024/04/25 17:53
用 PS 操作 IE
一、抑制警告窗口
$win.execScript("window.alert=function(){}", "javascript")
二、调用 execScript 时出错
使用“2”个参数调用“execScript”时发生异常:“由于出现错误 80020101 而导致此项操作无法完成。”
获得焦点,好像更有利于窗口的打开。
$ie.Document.parentWindow.focus()
三、弹出窗口,且关闭原窗口,使原来的操作句柄失效,必需要找到新的弹出窗口,才能进行下一步的操作。
function returnWindow($s){
(New-Object -ComObject Shell.Application).Windows() `
| Where { $_.FullName.toLower().EndsWith("iexplore.exe") } `
| where { $_.LocationURL -eq $s }
# $s 为 "弹出窗口的新地址"
}
四、等待 IE 加载完成
function waitForLoad ($ie) {
while ( $ie.Busy ){ Start-Sleep -Milliseconds 100}
}
五、PS 2.0 对 mshtml 的封装不完善。对于没有 ID 或没有唯一 name 的元素无法进行操作。升级到 PS 3.0 以后,就没有这个问题了。
$buttons.length 返回空,没有 $buttons.item 属性。
$doc = $ie.Document
$buttons = $doc.getElementsByTagName( "input")
if ($buttons.length -gt 0 ){
$buttons.item(1).click()
}
六、在 PS 控制台中运行正常,但是,不能在任务计划中运行。
$ie.Document.parentWindow.focus()
一、抑制警告窗口
$win.execScript("window.alert=function(){}", "javascript")
二、调用 execScript 时出错
使用“2”个参数调用“execScript”时发生异常:“由于出现错误 80020101 而导致此项操作无法完成。”
获得焦点,好像更有利于窗口的打开。
$ie.Document.parentWindow.focus()
三、弹出窗口,且关闭原窗口,使原来的操作句柄失效,必需要找到新的弹出窗口,才能进行下一步的操作。
function returnWindow($s){
(New-Object -ComObject Shell.Application).Windows() `
| Where { $_.FullName.toLower().EndsWith("iexplore.exe") } `
| where { $_.LocationURL -eq $s }
# $s 为 "弹出窗口的新地址"
}
四、等待 IE 加载完成
function waitForLoad ($ie) {
while ( $ie.Busy ){ Start-Sleep -Milliseconds 100}
}
五、PS 2.0 对 mshtml 的封装不完善。对于没有 ID 或没有唯一 name 的元素无法进行操作。升级到 PS 3.0 以后,就没有这个问题了。
$buttons.length 返回空,没有 $buttons.item 属性。
$doc = $ie.Document
$buttons = $doc.getElementsByTagName( "input")
if ($buttons.length -gt 0 ){
$buttons.item(1).click()
}
六、在 PS 控制台中运行正常,但是,不能在任务计划中运行。
$ie.Document.parentWindow.focus()
0 0
- 用 PS 操作 IE
- ps操作
- PS操作
- ps操作
- PS操作02 - PS基本功能
- 用PS替换图标的详细操作
- vc用com操作ie
- 用matlab进行ie操作
- 操作IE
- 【PS】简单操作
- 常用的PS操作
- ps基本操作
- PS的简单操作!
- ps常用操作
- PS-基本操作
- PS常用操作
- PS的基础操作
- PS基本操作
- adb logcat -b main -b system
- 汇编版--LinkedList
- 黑马程序员—银行业务系统
- PyCharm常用快捷键
- 一些有用的sql语句
- 用 PS 操作 IE
- mysql 安装手册
- 码码可以灵活地应用sql函数
- mac和phy的关系
- Linux常用命令英文全称与中文解释Linux系统
- double精度问题
- 我的求学和程序员之路(必看)[推荐]
- 客户要求压缩进度,项目经理怎么办?
- ruby loop循环