Answer the question
In order to leave comments, you need to log in
Powershell. How to run Selenium in Webbrowser form?
Good afternoon, dear connoisseurs.
There is a code that calls the page through Firefox (accordingly, FF opens and the page loads):
[Reflection.Assembly]::LoadFrom("C:\selenium\net40\GeckoDriver.dll")
$url = "http://yandex.ru/"
$ie = New-Object OpenQA.Selenium.Firefox.FirefoxDriver
$ie.Navigate().GoToUrl($url)
$ie.Quit()
Add-Type -AssemblyName System.Windows.Forms
$URL1 = ""
# WinForm Setup
$mainForm = New-Object System.Windows.Forms.Form
$mainForm.Font = “Comic Sans MS,9"
$mainForm.ForeColor = [System.Drawing.Color]::White
$mainForm.BackColor = [System.Drawing.Color]::DarkSlateBlue
$mainForm.Text = " System.Windows.Forms.WebBrowser Class"
$mainForm.Width = 960
$mainForm.Height = 750
# Main Browser
$webBrowser1 = New-Object System.Windows.Forms.WebBrowser
$webBrowser1.URL = $URL1
$webBrowser1.Width = 600
$webBrowser1.Height = 600
$webBrowser1.Location = "50, 25"
$mainForm.Controls.Add($webBrowser1)
# Display Form
[void] $mainForm.ShowDialog()
Answer the question
In order to leave comments, you need to log in
no, you can't. and if it is possible, then there are such dances with a tambourine ...
the web browser object works only through the Internet Explorer.
here they write that mozilla has its own, but I never worked with it: stackoverflow.com/questions/1949532/how-to-change-...
but even making it work, setting selenium on it would be hellish torment.
I think you overcomplicated your project. if you explained the end goal of the entire project, perhaps someone would suggest an easier way.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question