Cannot find context with specified id with chromedriver - c#

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.

Related

.Net Maui - Operation Timeout when trying to build

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!

Getting error "OpenQA.Selenium.WebDriverException: invalid session id" upon running selenium script

Below is my script, upon running my script passes but I see that not all of the methods are executed and there is an error in the console.
Error in console:
(Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729#{#29}),platform=Windows NT 10.0.17134 x86_64)
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value)
at OpenQA.Selenium.Remote.RemoteWebDriver.FindElementById(String id)
at OpenQA.Selenium.By.<>c__DisplayClass16_0.<Id>b__0(ISearchContext context)
at OpenQA.Selenium.By.FindElement(ISearchContext context)
at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by)
at Selenium_testing.SearchTCOData.SearchtCOData() in C:\Users\dvemula\source\repos\Selenium testing\Selenium testing\SearchTCOData.cs:line 23
at Selenium_testing.Login.Main(String[] args) in C:\Users\dvemula\source\repos\Selenium testing\Selenium testing\login.cs:line 24
Code:
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System;
using System.Threading;
class LoginTCO
{
static IWebDriver driver = new ChromeDriver();
static void main()
{
driver.Navigate().GoToUrl("someurl");
Thread.Sleep(10000);
Click();
Console.WriteLine("clicked");
driver.Quit();
}
private static void Click()
{
driver.FindElement(By.CssSelector(".glyphicon-th-list")).Click();
driver.FindElement(By.CssSelector(".glyphicon-wrench")).Click();
driver.FindElement(By.CssSelector(".glyphicon-paste")).Click();
driver.FindElement(By.CssSelector(".idicon")).Click();
}
}
There are 2 reasons when this issue may occur.
1)Case when WebDriverManager is not in use and somehow chromedriver.exe binary was updated which supports chrome browser version 74 but OS having browser as 72. In this case you would need to update binary compatible to browser version.
2)When WebDriverManager is in use which downloads browser binary automatically. Its tries to download latest chromedriver binary which may not be compatible to your chrome browser installed version let say 72 (my guess). If so, in that case we have to download chromedriver binary which would be compatible to your browser version 72. For doing so, please take a reference of below line for this problem.
Issue with Latest Chrome Driver Version 74

selenium not finding firefox - using teststack.seleno

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/")));

Python.CreateEngine() eventually throws System.Reflection.TargetInvocationException

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:

EventStore & RavenDB Persistence JsonReaderException

Trying to wire up JOliver's EventStore with RavenDB and hit a snag.
I created a new DB in Raven called RavenEventStore.
The following is my wireup;
return Wireup.Init()
.UsingRavenPersistence("RavenEventStore")
.UsingAsynchronousDispatchScheduler()
.DispatchTo(new DelegateMessageDispatcher(DispatchCommit))
.Build();
When the Wireup.Init() is called, this exception is occuring on the RavenDb side;
Url: "/indexes/RavenCommitByDate" Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: . Line 1, position 1.
at Newtonsoft.Json.JsonTextReader.ParseValue(Char currentChar) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\JsonTextReader.cs:line 699
at Newtonsoft.Json.JsonTextReader.ReadInternal() in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\JsonTextReader.cs:line 499
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, Type t, JsonConverter propertyConverter) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 1072
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 118
at Raven.Database.Extensions.HttpExtensions.ReadJsonObject[T](IHttpContext context) in c:\Builds\raven\Raven.Database\Extensions\HttpExtensions.cs:line 57
at Raven.Database.Server.Responders.Index.Put(IHttpContext context, String index) in c:\Builds\raven\Raven.Database\Server\Responders\Index.cs:line 64
at Raven.Database.Server.Responders.Index.Respond(IHttpContext context) in c:\Builds\raven\Raven.Database\Server\Responders\Index.cs:line 49
at Raven.Database.Server.HttpServer.DispatchRequest(IHttpContext ctx) in c:\Builds\raven\Raven.Database\Server\HttpServer.cs:line 477
at Raven.Database.Server.HttpServer.HandleActualRequest(IHttpContext ctx) in c:\Builds\raven\Raven.Database\Server\HttpServer.cs:line 259
I can see the exception in the RavenDB log as well;
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: . Line 1, position 1. at Newtonsoft.Json.JsonTextReader.ParseValue(Char currentChar) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\JsonTextReader.cs:line 699 at Newtonsoft.Json.JsonTextReader.ReadInternal() in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\JsonTextReader.cs:line 499 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, Type t, JsonConverter propertyConverter) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 1072 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 118 at Raven.Database.Extensions.HttpExtensions.ReadJsonObject[T](IHttpContext context) in c:\Builds\raven\Raven.Database\Extensions\HttpExtensions.cs:line 57 at Raven.Database.Server.Responders.Index.Put(IHttpContext context, String index) in c:\Builds\raven\Raven.Database\Server\Responders\Index.cs:line 64 at Raven.Database.Server.Responders.Index.Respond(IHttpContext context) in c:\Builds\raven\Raven.Database\Server\Responders\Index.cs:line 49 at Raven.Database.Server.HttpServer.DispatchRequest(IHttpContext ctx) in c:\Builds\raven\Raven.Database\Server\HttpServer.cs:line 477 at Raven.Database.Server.HttpServer.HandleActualRequest(IHttpContext ctx) in c:\Builds\raven\Raven.Database\Server\HttpServer.cs:line 259
I have attempted to eliminate all possibilities by removing the UsingAsynchronousDispatchScheduler() method as well and incur the same error.
The code I am using is strictly from the Example located here:
https://github.com/joliver/EventStore/blob/master/doc/EventStore.Example/MainProgram.cs
Has anyone experienced this? Have failed to find anything on Google as well.
Ryan,
You are using an older server (pre 888) with a new client (888 or later)
Your problem may be similar to this one:
EventStore + RavenDB, not deserializing correct
Also, I would definitely recommend using a custom build against Raven build 888 (or later) as Oren has suggested until I can get a new release out against a newer version of Raven.

Categories