My selenium tests are all failing on initalisation with this error.
{"The system cannot find the file specified"}
My initialisation code is really simple:
public static class Host
{
private static readonly SelenoHost SelenoHost = new SelenoHost();
static Host()
{
Instance.Run(
configure => configure
.UsingLoggerFactory(new ConsoleFactory())
.WithWebServer(new InternetWebServer("http://localhost:9000/")));
Instance.Application.Browser.Manage().Window.Size = new Size(1500, 1000);
}
public static SelenoHost Instance => SelenoHost;
}
}
Firefox is installed in the default location, (C:\Program Files (x86)\Mozilla Firefox\firefox.exe) and is updated to the latest version (42).
I am using Windows 10 Operating System.
I am using studio 2015.1
If it helps, this is the stack trace.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at OpenQA.Selenium.Firefox.Internal.Executable.LocateFirefoxBinaryFromPlatform()
at OpenQA.Selenium.Firefox.Internal.Executable..ctor(String userSpecifiedBinaryPath)
at OpenQA.Selenium.Firefox.FirefoxBinary..ctor(String pathToFirefoxBinary)
at TestStack.Seleno.Configuration.BrowserFactory.<FireFox>b__b() in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\BrowserFactory.cs:line 73
at TestStack.Seleno.Configuration.WebDriverBuilder`1.CreateWebDriver() in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\WebDriverBuilder.cs:line 88
at TestStack.Seleno.Configuration.BrowserFactory.FireFox() in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\BrowserFactory.cs:line 73
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p) in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\Interceptors\SelenoReceivedException.cs:line 0
at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\Interceptors\SelenoReceivedException.cs:line 0
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\Interceptors\SelenoReceivedException.cs:line 0
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\Interceptors\SelenoReceivedException.cs:line 0
at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\Interceptors\SelenoReceivedException.cs:line 0
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\Interceptors\SelenoReceivedException.cs:line 0
at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) in c:\ConsoleBuildAgent\work\6625a30e8ee728ba\src\TestStack.Seleno\Configuration\Interceptors\SelenoReceivedException.cs:line 0
I have discovered that this is possibly a bug.
I have discovered that supplying a WebDriver, and default Profile seems to alleviate the problem.
This solution allows a single instance of Firefox to run. If an existing instance is present (open) then a different error is thrown when creating the driver.
An exception of type 'OpenQA.Selenium.WebDriverException' occurred in
WebDriver.dll but was not handled in user code
Additional information:
Unable to bind to locking port 7054 within 45000 milliseconds
As long as you make sure all firefox instances are closed prior to running the tests, this code works:
Instance.Run(
configure => configure
.WithRemoteWebDriver(
() => new FirefoxDriver(
new FirefoxBinary(#"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"),
new FirefoxProfile()))
.UsingLoggerFactory(new ConsoleFactory())
.WithWebServer(new InternetWebServer("http://localhost:9000/")));
Related
I'm having an issue when building/running a default new Maui application.
I create a new .NET Maui App (Preview) and make no changes to the autogenerated codebase, but when I try to build or run the application I am getting the following timeout error.
Severity Code Description Project File Line Suppression State
Error MAUI0000 System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.OpenAndPush(Uri uri)
at System.Xml.XmlTextReaderImpl.PushExternalEntityOrSubset(String publicId, String systemId, Uri baseUri, String entityName)
at System.Xml.XmlTextReaderImpl.DtdParserProxy_PushExternalSubset(String systemId, String publicId)
at System.Xml.DtdParser.ParseExternalSubset()
at System.Xml.DtdParser.ParseInDocumentDtd(Boolean saveInternalSubset)
at System.Xml.DtdParser.Parse(Boolean saveInternalSubset)
at System.Xml.DtdParser.System.Xml.IDtdParser.ParseInternalDtd(IDtdParserAdapter adapter, Boolean saveInternalSubset)
at System.Xml.XmlTextReaderImpl.ParseDtd()
at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at Svg2VectorDrawable.SvgTree.Parse(String filename) in /Users/runner/work/Svg2VectorDrawable.Net/Svg2VectorDrawable.Net/Svg2VectorDrawable.Net/SvgTree.cs:line 35
at Svg2VectorDrawable.Svg2Vector.Parse(String file) in /Users/runner/work/Svg2VectorDrawable.Net/Svg2VectorDrawable.Net/Svg2VectorDrawable.Net/Svg2Vector.cs:line 84
at Svg2VectorDrawable.Svg2Vector.ParseSvgToXml(String inputSvgFilename, Stream outputStream) in /Users/runner/work/Svg2VectorDrawable.Net/Svg2VectorDrawable.Net/Svg2VectorDrawable.Net/Svg2Vector.cs:line 773
at Svg2VectorDrawable.Svg2Vector.Convert(String inputSvgFilename, String outputXmlFilename) in /Users/runner/work/Svg2VectorDrawable.Net/Svg2VectorDrawable.Net/Svg2VectorDrawable.Net/Svg2Vector.cs:line 759
at Microsoft.Maui.Resizetizer.AndroidAdaptiveIconGenerator.Generate() in D:\a\1\s\src\SingleProject\Resizetizer\src\AndroidAdaptiveIconGenerator.cs:line 73
at Microsoft.Maui.Resizetizer.ResizetizeImages.ProcessAppIcon(ResizeImageInfo img, ConcurrentBag`1 resizedImages) in D:\a\1\s\src\SingleProject\Resizetizer\src\ResizetizeImages.cs:line 132
at Microsoft.Maui.Resizetizer.ResizetizeImages.<>c__DisplayClass26_0.<ExecuteAsync>b__0(ResizeImageInfo img) in D:\a\1\s\src\SingleProject\Resizetizer\src\ResizetizeImages.cs:line 88
at Microsoft.Maui.Resizetizer.AsyncTaskExtensions.<>c__DisplayClass0_0`1.<ParallelForEach>b__0(TSource s) in D:\a\1\s\src\SingleProject\Resizetizer\src\AsyncTaskExtensions.cs:line 21 MauiApp C:\Users\rea\.nuget\packages\microsoft.maui.resizetizer.sdk\6.0.101-preview.10.2068\build\Microsoft.Maui.Resizetizer.Sdk.targets 463
I am running
vs2022 preview 1.1
dotnet v6.0.100
Android 12.0 (SDK 31)
Can someone help with what I'm missing?
Sorry it took a while! It's weird that it would spawn this error, but I think you might want to avoid using MauiApp as a name for your solution and project as it's also a type in the source and that causes issues for me to build it as well.
Try again with a solution with a different name and let me know if that solves it!
I have written a C# test automation Framework on .netcore 3.1 that is using Specflow and Specrun.
I can run the tests with Specrun and get a report, however I would like to get an Allure report.
So I have installed Specflow.Allure. I have an allureConfig.json.
I was hoping that I could now just run the tests and get an Allure report.
However it seems it is not that simple.
When I try to run the tests if fails with the message shown below.
Anyone know what I am doing wrong? Do I need to add more code in order to get the Allure report?
Message:
Value cannot be null. (Parameter 'key')
Stack Trace:
System.ArgumentNullException: Value cannot be null. (Parameter 'key')
ConcurrentDictionary2.ThrowKeyNullException()
ConcurrentDictionary2.TryGetValue(TKey key, TValue& value)
ConcurrentDictionary2.get_Item(TKey key)
AllureStorage.Get[T](String uuid)
AllureLifecycle.UpdateFixture(String uuid, Action1 update)
AllureLifecycle.UpdateFixture(Action1 update)
AllureLifecycle.StopFixture(Action1 beforeStop)
AllureBindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
TestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType) line 352
RunnerTestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType)
TestExecutionEngine.FireEvents(HookType hookType) line 338
TestExecutionEngine.FireScenarioEvents(HookType bindingEvent) line 322
RunnerTestExecutionEngine.FireScenarioEvents(HookType bindingEvent)
TestExecutionEngine.OnScenarioStart() line 199
RunnerTestExecutionEngine.OnScenarioStart()
TestRunner.OnScenarioStart() line 55
LM01InitialCaseFeature.ScenarioStart()
LM01InitialCaseFeature.LM01_01DefaultLM01InitialCase() line 4
StaticOrInstanceMethodExecutor.ExecuteInternal(ITestThreadExecutionContext testThreadExecutionContext)
StaticOrInstanceMethodExecutor.Execute(ITestThreadExecutionContext testThreadExecutionContext)
TestNodeTask.Execute()
The solution to this was to add specflow.json file and set to 'copy if newer' so it copies to the debug folder.
The content of specflow.json was:
{
"stepAssemblies": [
{
"assembly": "Allure.SpecFlowPlugin"
}
]
}
After making this change the tests ran correctly and an Allure report was generated.
Do any of you know a workaround that would turn off the behaviour mentioned in the title? Each time I do something wrong in my test steps, the exception looks like below:
Test method
FunctionalTests.Features.Parties.PartyAddingFeature.FeatureTitle threw exception:
TechTalk.SpecFlow.BindingException: Error calling binding method 'FunctionalTests:FunctionalTests.Steps.PartiesSteps.GivenLegacyPartyUpsertedIntegrationEventCameInWithData(String, Table)': Object of type 'System.String' cannot be converted to type 'System.Int32'.
at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) in D:\a\1\s\TechTalk.SpecFlow\Bindings\BindingInvoker.cs:line 69
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments) in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs:line 395
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(IContextManager contextManager, StepInstance stepInstance) in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs:line 316
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep() in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs:line 132
at FunctionalTests.Features.Parties.PartyAddingFeature.ScenarioCleanup()
at FunctionalTests.Features.Parties.PartyAddingFeature.FeatureTitle() in C:\Project\test\Services\FunctionalTests\Features\Parties\PartyAdding.feature:line 25
By your opinion, what should be correct exception for this situation?
I mean, we don’t see or know your code. And by stack trace you posted, it indicates that you have situation with parameter conversion before entering one of Given/when/then method.
I'm having trouble running my automated tests.
In this line:
Wait.Until(ExpectedConditions.ElementExists(findElement))
"findElement" is a element into a frame, and I'm the switch before the interacty.
I'm think that problem is caused because de Google Chrome was update for the version 63.0.3239.108, because this line not changed for 3 months.
Language: C#
Google Chrome version: 63.0.3239.108
Chromedriver version: 2.34.522940
Full StackTracke:
Test Name: TrocarTecnologiaTest
Test FullName: AutomacaoIntegra.Tests.TestTrocarTecnologia.TrocarTecnologiaTest
Test Source: C:\git_repository\integra_test\AutomacaoIntegra\Tests\TestTrocarTecnologia.cs : line 39
Test Outcome: Failed
Test Duration: 0:00:16,571
Result StackTrace:
em OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
em OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
em OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value)
em OpenQA.Selenium.Remote.RemoteWebDriver.FindElementById(String id)
em OpenQA.Selenium.By.<>c__DisplayClass16_0.<Id>b__0(ISearchContext context)
em OpenQA.Selenium.By.FindElement(ISearchContext context)
em OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by)
em OpenQA.Selenium.Support.UI.ExpectedConditions.<>c__DisplayClass6_0.<ElementExists>b__0(IWebDriver driver)
em OpenQA.Selenium.Support.UI.DefaultWait`1.Until[TResult](Func`2 condition)
em AutomacaoIntegra.Extensions.Element_Extensions.EsperarElemento(IWebDriver driver, By findElement) na C:\git_repository\integra_test\AutomacaoIntegra\Extensions\Element_Extensions.cs:linha 126
em AutomacaoIntegra.PageObjects.SolicitacaoPage.PesquisarClienteBeneficiario(String CPF) na C:\git_repository\integra_test\AutomacaoIntegra\PageObjects\SolicitacaoPage.cs:linha 117
em AutomacaoIntegra.Tests.TestTrocarTecnologia.TrocarTecnologiaTest() na C:\git_repository\integra_test\AutomacaoIntegra\Tests\TestTrocarTecnologia.cs:linha 48
Result Message:
System.InvalidOperationException : unknown error: unhandled inspector error: {"code":-32000,"message":"Cannot find context with specified id"}
(Session info: chrome=63.0.3239.108)
(Driver info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),platform=Windows NT 10.0.14393 x86_64)
The problem was because the Google Chrome updated for the 63.0.3239.108 version. I was a downgrade for the 61 version and my system is normal.
After several cycles of debugging, Python.CreateEngine() eventually throws the exception shown below. I don't know why this is occurring and the version that I have installed is actually 2.7.4.1. I end up reinstalling IronPython and the exception disappears, but it eventually returns. I am using VS2010 with Windows 7.
System.Reflection.TargetInvocationException occurred
HResult=-2146232828
Message=Failed to load language 'IronPython 2.7.2.1': Method not found: '!!1[] Microsoft.Scripting.Utils.ArrayUtils.ConvertAll(!!0[], System.Func`2<!!0,!!1>)'.
Source=Microsoft.Scripting
StackTrace:
at Microsoft.Scripting.Runtime.LanguageConfiguration.LoadLanguageContext(ScriptDomainManager domainManager, Boolean& alreadyLoaded)
at Microsoft.Scripting.Runtime.DlrConfiguration.LoadLanguageContext(ScriptDomainManager manager, LanguageConfiguration config)
at Microsoft.Scripting.Runtime.DlrConfiguration.TryLoadLanguage(ScriptDomainManager manager, AssemblyQualifiedTypeName providerName, LanguageContext& language)
at Microsoft.Scripting.Runtime.ScriptDomainManager.GetLanguageByTypeName(String providerAssemblyQualifiedTypeName)
at Microsoft.Scripting.Hosting.ScriptRuntime.GetEngineByTypeName(String assemblyQualifiedTypeName)
at IronPython.Hosting.Python.GetEngine(ScriptRuntime runtime)
at IronPython.Hosting.Python.CreateEngine()
at OneWireTest.Form1.InitializeScriptEngine() in D:\IPYTest\Form1.cs:line 374
InnerException: System.MissingMethodException
HResult=-2146233069
Message=Method not found: '!!1[] Microsoft.Scripting.Utils.ArrayUtils.ConvertAll(!!0[], System.Func`2<!!0,!!1>)'.
Source=IronPython
StackTrace:
at IronPython.Runtime.PythonContext..ctor(ScriptDomainManager manager, IDictionary`2 options)
InnerException: