我尝试了以下方法:
$this->model->method(), $this->view->method()
但是我得到了错误:
$edge = New-Object -com microsoft-edge.application
$edge.visible = $true
$edge.FullScreen = $true
我在这里明显做错了吗?
编辑17/07/2019-我已更改为以下内容:
New-Object : Retrieving the COM class factory for component with CLSID
{00000000-0000-0000-0000-000000000000} failed
due to the following error: 80040154 Class not registered (Exception from
HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
At line:1 char:9
+ $edge = New-Object -com microsoft-edge.application
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [New-Object], COMException
+ FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand
所以现在Edge会打开,但是“可见”和“全屏”命令会返回错误-任何人有任何想法吗?
欢呼
答案 0 :(得分:2)
您可以使用以下命令打开Microsoft Edge浏览器并导航到特殊URL。
start microsoft-edge:http://google.com
编辑:
如果要使用Edge Webdriver打开IE浏览器,可以从this link下载Edge webdriver,并参考this article进行使用。
答案 1 :(得分:1)
我认为这可能是解决方案:
start microsoft-edge:http://google.com
$wshell = New-Object -ComObject wscript.shell;
$wshell.AppActivate('Google - Microsoft Edge')
Sleep 2
$wshell.SendKeys('{F11}')
我在这里找到了上面的代码:start microsoft edge in fullscreen
您可以根据需要发送不同的边缘密钥: How to send CTRL or ALT + any other key?
您可以在Edge窗口中找到所需快捷键。
您可以尝试使用此方法(来源是下面的链接):
Start-Process -FilePath ($Env:WinDir + "\explorer.exe") -ArgumentList "shell:Appsfolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge"
还有一种在隐身模式下打开它的方法:
答案 2 :(得分:0)
现有答案可能适用于某些环境,但是不能保证它们,因为它们直接使用别名 start
而不是 Start-Process
命令。
It is best to use the command directly in scripts.
Open Edge 全屏:
Start-Process microsoft-edge: -WindowStyle maximized
说明
Start-Process
命令在 microsoft-edge 上执行,参数 -WindowStyle
设置为最大化。这将打开边缘并将其最大化到全屏。
全屏打开 Edge 并导航到指定网页:
Start-Process microsoft-edge:https://stackoverflow.com -WindowStyle maximized
说明
和以前一样,Start-Process
命令在 microsoft-edge 上执行,:
指定打开 https://stackoverflow.com。设置为最大化的参数 -WindowStyle
将全屏显示 Edge 并加载 stackoverflow.com。