gpt4 book ai didi

watin - 使用SpecRun时WatiN引发错误

转载 作者:行者123 更新时间:2023-12-03 12:27:44 26 4
gpt4 key购买 nike

我尝试通过Nugget安装SpecRun。运行功能时,出现以下错误:

[ERROR] Get to the Contact Page: The CurrentThread needs to have it's ApartmentState set to ApartmentState.STA to be able to automate Internet Explorer.


System.Threading.ThreadStateException:CurrentThread需要将其ApartmentState设置为ApartmentState.STA才能自动执行Internet Explorer。
在WatiN.Core.IE.CheckThreadApartmentStateIsSTA()
在WatiN.Core.IE.CreateNewIEAndGoToUri(Uri uri,IDialogHandler logonDialogHandler,Boolean createInNewProcess)
在WatiN.Core.IE..ctor()

任何想法如何解决这一问题?

附加信息:

研究

根据 http://watin.org/documentation/sta-apartmentstate/,使用WatiN时需要将Thread.Apartmentstate设置为STA。但是,为了使用上一个链接中未提到的测试运行程序,您需要通过电子邮件发送电子邮件(已发送电子邮件)。

我的App.config具有以下内容:

  <specFlow>
<!-- For additional details on SpecFlow configuration options see https://github.com/techtalk/SpecFlow/wiki/Configuration -->
<unitTestProvider name="SpecRun" runtimeProvider="TechTalk.SpecRun.SpecFlowPlugin.SpecRunRuntimeProvider, TechTalk.SpecRun.SpecFlowPlugin" generatorProvider="TechTalk.SpecRun.SpecFlowPlugin.Generator.SpecRunGeneratorWith, TechTalk.SpecRun.SpecFlowPlugin.Generator" />
<trace traceTimings="false" listener="TechTalk.SpecRun.SpecFlowPlugin.SpecRunListener, TechTalk.SpecRun.SpecFlowPlugin" />
</specFlow>

最佳答案

现在在新版本的SpecRun version 0.14.0中引入了STA支持

release notes

    0.14.0 - 2012/04/20 
- Extended beta expiration until 30/05/2012
New features:
...
- Support for STA/MTA apartment state through the execution settings
of the profile: <Execution apartmentState="STA" />

因此,它现在应该与Watin一起使用。

关于watin - 使用SpecRun时WatiN引发错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9822299/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com