收录日期:2019/12/09 08:14:38 时间:2010-10-29 07:07:48 标签:windows,internet-explorer,powershell,automated-tests,add-on

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}

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