开发者

Deactivate add-ons by start IE with powershell (for automated tests)

I write a script for automated tests. I want that the IE runs without add-ons. It would be OK if set this after the start of it, but it is important that I can work with the IE. (I must can to grab it for my testing).

I want start IE with following powershell-script:

$ie = new-object -comobject InternetExplorer.Application -property @{navigate2=$testURL; visible = $true}
开发者_Python百科

Currently I use a not so good/clean alternative. I open an empty IE and create an empty com-object ... see by oneself:

$a = Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion -name ProgramFilesDir 
$b = $a.ProgramFilesDir + "\Internet Explorer\iexplore.exe" 
& $b about:blank -extoff    #start IE without extensions 

$app = new-object -com shell.application   #create empty comobject  
Start-Sleep 2  
$ie = $app.windows() | where {$_.Type -eq "HTML-Dokument" -and $_.LocationURL -match "about:blank"}  
#$app allocate to $ie

How can I deactivate the add-ons on this line: $ie = new-object -comobject InternetExplorer.Application ... , or there are other alternatives for my purposes?

thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜