Created
April 26, 2018 14:58
-
-
Save gitfvb/ebd6cbb365a93f6ce712c61c419de3d3 to your computer and use it in GitHub Desktop.
use firefox browser through powershell and avoid the internal browser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list enumns | |
# [enum]::getValues([type]"System.Windows.Forms.DockStyle") | |
# get value of enum entry | |
# [System.Windows.Forms.DockStyle]::Fill.value__ | |
# enum link https://blogs.technet.microsoft.com/heyscriptingguy/2015/08/27/working-with-enums-in-powershell-5/ | |
cd "C:\FastStats\Build\salesforce\preload\" | |
# use firefox in powershell | |
# https://www.nuget.org/packages/Geckofx45.64/ | |
$assemblyCore = [Reflection.Assembly]::LoadFile("C:\FastStats\Build\salesforce\preload\Geckofx-Core.dll") | |
$assemblyWinforms = [Reflection.Assembly]::LoadFile("C:\FastStats\Build\salesforce\preload\Geckofx-Winforms.dll") | |
Add-Type -AssemblyName System.Windows.Forms | |
[Gecko.Xpcom]::Initialize("C:\FastStats\Build\salesforce\preload\Firefox") | |
$web = New-Object -TypeName Gecko.GeckoWebBrowser -Property @{ Dock=[System.Windows.Forms.DockStyle]::Fill.value__ } | |
$form = New-Object -TypeName System.Windows.Forms.Form -Property @{Width=640;Height=840} | |
$form.Controls.Add($web) | |
$web.Navigate("www.google.com"); | |
$form.Add_Shown({$form.Activate()}) | |
$form.ShowDialog() | Out-Null | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment