OpenQA.Selenium.WebDriverException : unknown error: Chrome failed to start: exited abnormally on CodeFresh
OpenQA.Selenium.WebDriverException : unknown error: Chrome failed to start: exited abnormally on CodeFresh
运行在 CodeFresh 中进行冒烟测试时,我们偶尔会遇到此错误
[xUnit.net 00:02:41.43] OpenQA.Selenium.WebDriverException : unknown error: Chrome failed to start: exited abnormally.
[xUnit.net 00:02:41.43] (unknown error: DevToolsActivePort file doesn't exist)
[xUnit.net 00:02:41.43] (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
[xUnit.net 00:02:41.43] Stack Trace:
[xUnit.net 00:02:41.43] at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
[xUnit.net 00:02:41.43] at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
[xUnit.net 00:02:41.43] at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
[xUnit.net 00:02:41.43] at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
[xUnit.net 00:02:41.43] at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
[xUnit.net 00:02:41.43] at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options)
[xUnit.net 00:02:41.43] /src/Features/Helpers/Hooks.cs(32,0): at Live_Automation.Features.Helpers.Hooks.BeforeScenario()
[xUnit.net 00:02:41.43] at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
[xUnit.net 00:02:41.43] at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType)
[xUnit.net 00:02:41.43] at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType hookType)
[xUnit.net 00:02:41.43] at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnScenarioStart()
[xUnit.net 00:02:41.43] at TechTalk.SpecFlow.TestRunner.OnScenarioStart()
[xUnit.net 00:02:41.43] at Live_Automation.Features.SmokeTestsOnLiveFeature.ScenarioStart()
这种情况平均发生在 10 次 运行 的 1 次测试中,通常只是下面的一种情况
Test Run Failed.
Total tests: 52
Passed: 51
Failed: 1
失败的测试是随机的,一天中可能发生这种情况的时间也是随机的。
测试套件围绕 Visual Studio/C#/Selenium/Xunit
构建
在极少数情况下我们会得到这个
[xUnit.net 00:03:26.88] OpenQA.Selenium.WebDriverException : unknown error: session deleted because of page crash
[xUnit.net 00:03:26.88] from unknown error: cannot determine loading status
[xUnit.net 00:03:26.88] from tab crashed
[xUnit.net 00:03:26.88] (Session info: headless chrome=87.0.4280.141)
[xUnit.net 00:03:26.88] Stack Trace:
[xUnit.net 00:03:26.88] at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
[xUnit.net 00:03:26.88] at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
[xUnit.net 00:03:26.88] at OpenQA.Selenium.Remote.RemoteWebDriver.set_Url(String value)
[xUnit.net 00:03:26.88] at OpenQA.Selenium.Remote.RemoteNavigator.GoToUrl(String url)
[xUnit.net 00:03:26.88] /src/Features/Pages/HomePage.cs(61,0): at Live_Automation.Features.Pages.HomePage.Visit()
[xUnit.net 00:03:26.88] at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
[xUnit.net 00:03:26.88] at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments)
[xUnit.net 00:03:26.88] at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(IContextManager contextManager, StepInstance stepInstance)
[xUnit.net 00:03:26.88] at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep()
[xUnit.net 00:03:26.88] at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors()
[xUnit.net 00:03:26.88] at Live_Automation.Features.SmokeTestsOnLiveFeature.ScenarioCleanup()
[xUnit.net 00:03:26.88] /src/Features/SmokeTests.feature(80,0): at Live_Automation.Features.SmokeTestsOnLiveFeature.TestFooterOptions(String footer, String url, String[] exampleTags)
现在当这种情况发生时,从这一点开始的所有方案都将失败
有没有人对造成这种情况的原因有任何想法。我不认为这是测试。
提前致谢
凯夫
这意味着您正在使用 send_keys(文件路径) 并且该文件不存在于该路径中
看看你是否在某些地方使用这个
我已经解决了这个问题。自从添加了这条线就没有问题了。
options.AddArguments("--disable-dev-shm-usage");
运行在 CodeFresh 中进行冒烟测试时,我们偶尔会遇到此错误
[xUnit.net 00:02:41.43] OpenQA.Selenium.WebDriverException : unknown error: Chrome failed to start: exited abnormally.
[xUnit.net 00:02:41.43] (unknown error: DevToolsActivePort file doesn't exist)
[xUnit.net 00:02:41.43] (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
[xUnit.net 00:02:41.43] Stack Trace:
[xUnit.net 00:02:41.43] at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
[xUnit.net 00:02:41.43] at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
[xUnit.net 00:02:41.43] at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
[xUnit.net 00:02:41.43] at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
[xUnit.net 00:02:41.43] at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
[xUnit.net 00:02:41.43] at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options)
[xUnit.net 00:02:41.43] /src/Features/Helpers/Hooks.cs(32,0): at Live_Automation.Features.Helpers.Hooks.BeforeScenario()
[xUnit.net 00:02:41.43] at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
[xUnit.net 00:02:41.43] at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType)
[xUnit.net 00:02:41.43] at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType hookType)
[xUnit.net 00:02:41.43] at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnScenarioStart()
[xUnit.net 00:02:41.43] at TechTalk.SpecFlow.TestRunner.OnScenarioStart()
[xUnit.net 00:02:41.43] at Live_Automation.Features.SmokeTestsOnLiveFeature.ScenarioStart()
这种情况平均发生在 10 次 运行 的 1 次测试中,通常只是下面的一种情况
Test Run Failed.
Total tests: 52
Passed: 51
Failed: 1
失败的测试是随机的,一天中可能发生这种情况的时间也是随机的。 测试套件围绕 Visual Studio/C#/Selenium/Xunit
构建在极少数情况下我们会得到这个
[xUnit.net 00:03:26.88] OpenQA.Selenium.WebDriverException : unknown error: session deleted because of page crash
[xUnit.net 00:03:26.88] from unknown error: cannot determine loading status
[xUnit.net 00:03:26.88] from tab crashed
[xUnit.net 00:03:26.88] (Session info: headless chrome=87.0.4280.141)
[xUnit.net 00:03:26.88] Stack Trace:
[xUnit.net 00:03:26.88] at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
[xUnit.net 00:03:26.88] at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
[xUnit.net 00:03:26.88] at OpenQA.Selenium.Remote.RemoteWebDriver.set_Url(String value)
[xUnit.net 00:03:26.88] at OpenQA.Selenium.Remote.RemoteNavigator.GoToUrl(String url)
[xUnit.net 00:03:26.88] /src/Features/Pages/HomePage.cs(61,0): at Live_Automation.Features.Pages.HomePage.Visit()
[xUnit.net 00:03:26.88] at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
[xUnit.net 00:03:26.88] at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments)
[xUnit.net 00:03:26.88] at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(IContextManager contextManager, StepInstance stepInstance)
[xUnit.net 00:03:26.88] at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep()
[xUnit.net 00:03:26.88] at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors()
[xUnit.net 00:03:26.88] at Live_Automation.Features.SmokeTestsOnLiveFeature.ScenarioCleanup()
[xUnit.net 00:03:26.88] /src/Features/SmokeTests.feature(80,0): at Live_Automation.Features.SmokeTestsOnLiveFeature.TestFooterOptions(String footer, String url, String[] exampleTags)
现在当这种情况发生时,从这一点开始的所有方案都将失败 有没有人对造成这种情况的原因有任何想法。我不认为这是测试。
提前致谢
凯夫
这意味着您正在使用 send_keys(文件路径) 并且该文件不存在于该路径中
看看你是否在某些地方使用这个
我已经解决了这个问题。自从添加了这条线就没有问题了。
options.AddArguments("--disable-dev-shm-usage");