Selenium,InternetExplorerDriver,ForceCreateProcessApi,超时还是没有浏览器启动?

问题描述

我们一直在使用Selenium在Internet Explorer中自动进行一些浏览器测试。在Windows 7 32位上,它可以正常工作。但是,我们正在64位Windows 10上对其进行测试,但它失败了。

  • 有时浏览器甚至无法启动
  • 如果我更改了驱动程序版本,则可以启动浏览器,但它会挂在第一页上
  • 仅当我使用ForceCreateProcessApi时才出现此问题。但是我需要使用ForceCreateProcessApi才能使用browserCommandLineArguments!
  • 例外是:60秒后,对URL http:// localhost:16639 / session的远程WebDriver服务器的HTTP请求超时。

这是我使用的PowerShell代码

$seleniumOptions = New-Object OpenQA.Selenium.IE.InternetExplorerOptions
$seleniumOptions.InitialbrowserUrl = $SiteUrl
$seleniumOptions.ForceCreateProcessApi = $true
$seleniumOptions.browserCommandLineArguments = "-k"
$seleniumOptions.IgnoreZoomLevel = $true

New-Variable -Name IEDS -Value ([OpenQA.Selenium.IE.InternetExplorerDriverService]) -Force
$defaultservice = $IEDS::CreateDefaultService()
        
$seleniumDriver = New-Object OpenQA.Selenium.IE.InternetExplorerDriver -ArgumentList @($defaultservice,$seleniumOptions)

我尝试了以下版本(x86和x64版本),但它们均无效:

2.25.3
3.141
3.9.0

有人可以建议如何进行这项工作吗?我已经确保根据文档设置了TabProcgrowth等。

谢谢。

解决方法

尝试使用3.150.1 32位驱动程序。

我不确定它在PS上的外观-但我可以使用此驱动程序配置来运行IE。

ie: { version: "3.150.1",arch: "ia32" }

我在这里也有iexplore.exe的密钥:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE

来自此config link