首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AutoSetUpConfiguredDrivers偶尔会抛出‘索引超出范围’异常

AutoSetUpConfiguredDrivers偶尔会抛出‘索引超出范围’异常
EN

Stack Overflow用户
提问于 2021-10-21 19:31:44
回答 1查看 34关注 0票数 0

下面是我的GlobalSetup的内容-当我运行的时候,对AutoSetUpConfiguredDrivers的调用偶尔会抛出一个异常:

索引:‘索引超出范围。必须是非负数并且小于集合的大小。(参数’System.ArgumentOutOfRangeException‘)’

代码语言:javascript
复制
        EdgeOptions Options = new EdgeOptions();
            Options.AddArgument("window-size=1600,900");
            Options.AcceptInsecureCertificates = true;

        EdgeOptions HeadlessOptions = new EdgeOptions();
            HeadlessOptions.AddArgument("headless");
            HeadlessOptions.AddArgument("window-size=1600,900");
            HeadlessOptions.AcceptInsecureCertificates = true;

        AtataContext.GlobalConfiguration
            .UseChrome().WithArguments("ignore-certificate-errors", "window-size=1600,900")
            .UseChrome().WithArguments("ignore-certificate-errors", "window-size=1600,900", "headless").WithAlias("chrome-headless")
            .UseFirefox().WithGlobalCapability("acceptInsecureCerts", true).WithArguments("--width=1600").WithArguments("--height=900")
            .UseFirefox().WithGlobalCapability("acceptInsecureCerts", true).WithArguments("--width=1600").WithArguments("--height=900").WithArguments("--headless").WithAlias("firefox-headless")
            .UseEdge().WithOptions(Options)
            .UseEdge().WithOptions(HeadlessOptions).WithAlias("edge-headless")
            .UseCulture("en-US")
            .AddScreenshotFileSaving()
            .UseNUnitTestName()
            .UseNUnitTestSuiteName()
            .UseNUnitTestSuiteType()
            .UseNUnitAssertionExceptionType()
            .UseNUnitAggregateAssertionStrategy()
            .UseNUnitWarningReportStrategy()
            .AddNUnitTestContextLogging()
                .WithMinLevel(LogLevel.Info)
                .WithoutSectionFinish()
            .LogNUnitError()
            .TakeScreenshotOnNUnitError("Test Failure")
            .OnCleanUpAddArtifactsToNUnitTestContext();            

        //DriverSetup.AutoSetUp(BrowserNames.Edge);
        AtataContext.GlobalConfiguration.AutoSetUpConfiguredDrivers(); 

如果我取消对DriverSetup行的注释,我永远看不到错误。使用Atata 1.13.0,Atata.WebDriverSetup 1.2.0和Selenium 4.0.0 -有什么想法吗?

--按要求--堆栈跟踪如下:

代码语言:javascript
复制
at System.ThrowHelper.ThrowArgumentOutOfRange_IndexException()
   at System.Collections.Generic.List`1.RemoveAt(Int32 index)
   at System.Collections.Generic.List`1.Remove(T item)
   at Atata.WebDriverSetup.DriverSetupConfigurationBuilder.SetUp()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Atata.WebDriverSetup.DriverSetupConfigurationBuilder.<SetUpAsync>d__11.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Atata.WebDriverSetup.DriverSetup.<AutoSetUpAsync>d__26.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Atata.WebDriverSetup.DriverSetup.<AutoSetUpAsync>d__28.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Atata.WebDriverSetup.DriverSetup.<AutoSetUpSafelyAsync>d__30.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Atata.WebDriverSetup.DriverSetup.AutoSetUpSafely(IEnumerable`1 browserNames)
   at Atata.MethodInfoExtensions.InvokeStaticAsLambda(MethodInfo method, Object[] args)
   at Atata.AtataContextBuilder.InvokeAutoSetUpSafelyMethodOfDriverSetup(IEnumerable`1 browserNames)
   at Atata.AtataContextBuilder.AutoSetUpConfiguredDrivers()
   at Atata.Config.SetUpFixture.GlobalSetUp() in C:\Source\fs.automation\Atata.Config\Atata.Config\SetUpFixture.cs:line 45
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-10-26 14:28:47

Atata.WebDriverSetup v1.2.0中存在线程同步错误。感谢您的报道。现在应该在Atata.WebDriverSetup v1.2.1中修复该问题。请更新程序包并验证此错误不会重现。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69667812

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档