Skip to content

Instantly share code, notes, and snippets.

@gitfvb
Created April 26, 2018 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gitfvb/ebd6cbb365a93f6ce712c61c419de3d3 to your computer and use it in GitHub Desktop.
Save gitfvb/ebd6cbb365a93f6ce712c61c419de3d3 to your computer and use it in GitHub Desktop.
use firefox browser through powershell and avoid the internal browser
# 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