This is my first stackoverflow question. I already searched for some answers on this site, but all the solutions I found didn't worked for me, or they were meant for Java or javascript.
The situation
As a junior automation tester I created a sort of Automation Test Framework in C# with the Selenium Webdriver and Protractor.Net.
The Framework consists of 2 parts.
The page objects
The tests
There is also a page object base class. In this class I defined methods that are used by every page object, such as a method for opening a specific program module.
In the tests, there is also a base class. In this class the Test attributes (C# UnitTest) are defined, such as TestInitialize, TestCleanup, AssemblyCleanup.
In the Test Base class I also defined the NgWebDriver, ChromeDriver:
driver = new NgWebDriver(new OpenQA.Selenium.Chrome.ChromeDriver());
driver.Manage().Window.Maximize();
In the Page Object Base class I defined a method to open a specific part of the
website:
public void OpenSPA(string spa)
{
driver.Navigate().GoToUrl(spa, true);
driver.Navigate().Refresh();
}
The pararmeter spa contains the url to navigate to.
The Testcase
The testcase is just simple:
open module x of the website
module x is just an url
The complete code of the testcase:
[TestMethod]
[TestCategory(cat), TestCategory(regression)]
public void Organisatie_CheckActief()
{
bool is_actief;
var organisatie = new CrmSPA(driver);
organisatie.VulVeld("Vrij zoeken", "XXXX");
is_actief = organisatie.IsRelatieActief();
//Assertion
Assert.IsTrue(is_actief == true, "Relatie is niet actief.");
The problem:
Since a couple of weeks ago I get the following error when running the testcase:
Test Name: Organisatie_CheckActief
Test FullName: FirstTest.Webdrivers.WijzigenOrganisatie_Basis.Organisatie_CheckActief
Test Source: C:\Users\XXXX\TestCases\\Organisatie\WijzigenOrganisatie_basis.cs : line 168
Test Outcome: Failed
Test Duration: 0:00:41,1353784
Result StackTrace:
bij OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
bij OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
bij OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteScriptCommand(String script, String commandName, Object[] args)
bij OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteAsyncScript(String script, Object[] args)
bij Protractor.NgWebDriver.set_Url(String value) in c:\Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\NgWebDriver.cs:regel 163
--- End of inner exception stack trace ---
bij Protractor.NgWebDriver.set_Url(String value) in c:\Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\NgWebDriver.cs:regel 193
bij Protractor.NgNavigation.GoToUrl(String url, Boolean ensureAngularApp) in c:\Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\NgNavigation.cs:regel 112
bij FirstTest.PageObjects.BaseSPA.OpenSPA(String spa) in C:\Users\\Documents\Visual Studio 2015\Projects\\\FirstTest\PageObjects\BaseSPA.cs:regel 55
bij FirstTest.PageObjects.CrmSPA.CrmSPA..ctor(NgWebDriver driver) in C:\Users\\Documents\Visual Studio 2015\Projects\\\FirstTest\PageObjects\CRM\CrmSPA\CrmSPA.cs:regel 37
bij FirstTest.Webdrivers.WijzigenOrganisatie_Basis.Organisatie_CheckActief() in C:\Users\\Documents\Visual Studio 2015\Projects\\\FirstTest\TestCases\RelatieSPA\Organisatie\WijzigenOrganisatie_basis.cs:regel 174
Result Message:
Test method FirstTest.Webdrivers.WijzigenOrganisatie_Basis.Organisatie_CheckActief threw exception:
System.InvalidOperationException: **Angular could not be found on the page** 'https://XXXXX/CRM/Relaties/ ---> OpenQA.Selenium.WebDriverTimeoutException: asynchronous script timeout: result was not received in 30 seconds
(Session info: chrome=66.0.3359.139)
(Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Windows NT 6.1.7601 SP1 x86_64)
The Result on screen/browser
When running the test the following happens:
the chrome browser starts (OK)
the chrome browser opens maximized (ok)
the chrome browser gets the url (ok)
the browser is empty shows blank page (NOK)
somehow i found the following error:
angular never provided resumeBootstrap
I searched on google and stackoverflow and i tried some answers like the synchronize option:
driver.IgnoreSynchronization
the problem does not always shows up. sometimes the page is loaded and the test continues.
I already tried to reinstall protractor-net, a newer chromedriver and seleniumdriver. The problem still exist.
If anyone can help me with this.
This error message...
OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
...implies that the RemoteWebDriver incurred an error while executing a command.
Selenium being an open source framework, you can have a look at the source code here.
GoToUrl() is defined in RemoteNavigator.cs and accepts only one argument string url as follows :
/// Navigate to a url for your test
/// </summary>
/// <param name="url">String of where you want the browser to go to</param>
public void GoToUrl(string url)
{
this.driver.Url = url;
}
But in your code block while invoking GoToUrl() method along with the string spa you have also passed true. This possibly raises the error.
Solution
Within GoToUrl() method removing the argument true will solve your issue.
Related
I'm currently facing an issue trying to run a selenium web automation with firefox(headless) on azure devops, I have the same browser version installed on the windows agent but still I get errors.
It works fine for Chrome on Azure and also locally it works fine for firefox so not really sure what is causing this issue.
These are the logs:
NUnit3TestExecutor discovered 2 of 2 NUnit test cases using Current Discovery mode, Non-Explicit run
1640697828054 geckodriver INFO Listening on [::1]:58930
1640697828085 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "enable-automation" "--no-sandbox" "--headless" "--disable-gpu" "--window-size=1920,1080" "-foreground" "-no-remote" "-profile" "C:\\Users\\agent\\AppData\\Local\\Temp\\rust_mozprofileQUnaTu"
1640697829048 Marionette INFO Marionette enabled
[GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open the file at C:\\Users\\agent\\AppData\\Local\\Temp\\rust_mozprofileQUnaTu\\search.json.mozlz4", (void 0)))
1640697832365 Marionette INFO Listening on port 58933
1640697832633 RemoteAgent WARN TLS certificate errors will be ignored for this session
1640697866771 Marionette INFO Stopped listening on port 58933
Given is presented the home page
-> error: Timed out after 30 seconds (33.8s)
And the user enters his credentials "empty"
-> skipped because of previous errors
Then Corresponding error message is displayed "empty"
-> skipped because of previous errors
1640697868763 geckodriver INFO Listening on [::1]:59006
Failed LoginWithBadInput("empty",null) [41 s]
Error Message:
OpenQA.Selenium.WebDriverTimeoutException : Timed out after 30 seconds
----> OpenQA.Selenium.NoSuchElementException : Unable to locate element: //h2[contains(text(),'Sign in with your email address')]
Stack Trace:
at OpenQA.Selenium.Support.UI.DefaultWait`1.Until[TResult](Func`2 condition)
at LFL.Automation.Framework.Actions.BaseActions.WaitFor(By by) in C:\agent\_work\3\s\Automation.Financial.Framework\Actions\BaseActions.cs:line 34
at ClientPortalAutomationFinal.Pages.LoginPage.ConfirmLoginPage() in C:\agent\_work\3\s\ClientPortalAutomationFinal\Pages\LoginPage.cs:line 49
at ClientPortalAutomationFinal.Steps.LoginSteps.GivenIsPresentedTheHomePage() in C:\agent\_work\3\s\ClientPortalAutomationFinal\Steps\LoginSteps.cs:line 29
at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments, TimeSpan& duration)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(IContextManager contextManager, StepInstance stepInstance)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep()
at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors()
at ClientPortalAutomationFinal.Features.LoginFeature.ScenarioCleanup()
at ClientPortalAutomationFinal.Features.LoginFeature.LoginWithBadInput(String flag, String[] exampleTags) in C:\agent\_work\3\s\ClientPortalAutomationFinal\Features\Login.feature:line 8
--NoSuchElementException
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.FindElementByXPath(String xpath)
at OpenQA.Selenium.By.<>c__DisplayClass19_0.<XPath>b__0(ISearchContext context)
at OpenQA.Selenium.By.FindElement(ISearchContext context)
at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by)
at LFL.Automation.Framework.Actions.BaseActions.<>c__DisplayClass11_0.<WaitFor>b__0(IWebDriver drv) in C:\agent\_work\3\s\Automation.Financial.Framework\Actions\BaseActions.cs:line 34
at OpenQA.Selenium.Support.UI.DefaultWait`1.Until[TResult](Func`2 condition)
Based on this looks like the browser it's opening but not able to navigate the website not really sure.
Hopefully someone has some idea of what could be the issue, thanks!
This error message...
OpenQA.Selenium.WebDriverTimeoutException : Timed out after 30 seconds
----> OpenQA.Selenium.NoSuchElementException : Unable to locate element: //h2[contains(text(),'Sign in with your email address')]
...implies that NoSuchElementException while trying to locate the element with the locator strategy.
Generally <h2> tags are header elements. Ideally, to locate any visible element you need to induce WebDriverWait for the ElementIsVisible() and you can use the following Locator Strategy:
Using XPath:
new WebDriverWait(driver, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.ElementIsVisible(By.XPath("//h2[contains(., 'Sign in with your email address')]")));
I am new to Apache spark and trying to run this on Windows machine with Mobius.
but i am getting exception while running it.
first of all i have setup following environment variables
JAVA_HOME C:\Program Files\Java\jdk1.8.0_152
HADOOP_HOME C:\winutils
SPARK_HOME c:\spark [spark-2.0.2-bin-hadoop2.6]
SPARKCLR_HOME E:\SparkClr\spark-clr_2.11-2.0.200\runtime
In code provided correct file to read data from as file:///E:/Mobius/Mobius/SampleText.txt
I tried to run it in debug mode
E:\SparkClr\spark-clr_2.11-2.0.200\runtime\scripts>sparkclr-submit.cmd debug
[sparkclr-submit.cmd] SPARKCLR_JAR=spark-clr_2.11-2.0.200.jar
[sparkclr-submit.cmd] LAUNCH_CLASSPATH="E:\SparkClr\spark-clr_2.11-2.0.200\runtime\lib\spark-clr_2.11-2.0.200.jar;c:\spark\jars\*"
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
17/12/19 11:34:23 INFO CSharpRunner: Starting CSharpBackend!
17/12/19 11:34:25 INFO CSharpRunner: Port number used by CSharpBackend is 5567
***********************************************************************
* [CSharpRunner.main] Backend running debug mode. Press enter to exit *
***********************************************************************
17/12/19 11:35:09 INFO SparkContext: Running Spark version 2.0.2
In my App.config Added following Entry [Port name with i got from above]
<add key="CSharpBackendPortNumber" value="5567"/>
I am getting below Exception message
JVM method execution failed: Nonstatic method partitions failed for class 12 when called with no parameters
Stack Trace
at Microsoft.Spark.CSharp.Interop.Ipc.JvmBridge.CallJavaMethod(Boolean isStatic, Object classNameOrJvmObjectReference, String methodName, Object[] parameters)
at Microsoft.Spark.CSharp.Interop.Ipc.JvmBridge.CallNonStaticJavaMethod(JvmObjectReference objectId, String methodName)
at Microsoft.Spark.CSharp.Proxy.Ipc.RDDIpcProxy.GetNumPartitions()
at Microsoft.Spark.CSharp.Core.RDD`1.GetDefaultPartitionNum()
at Microsoft.Spark.CSharp.Core.PairRDDFunctions.PartitionBy[K,V](RDD`1 self, Int32 numPartitions, Func`2 partitionFunc)
at Microsoft.Spark.CSharp.Core.PairRDDFunctions.ReduceByKey[K,V](RDD`1 self, Func`3 reduceFunc, Int32 numPartitions)
at Microsoft.Spark.CSharp.Examples.WordCountExample.Main(String[] args) in E:\Mobius\Mobius\examples\Batch\WordCount\Program.cs:line 35
I am not sure about CSharpWorkerPath.
Please help if anyone face this kind of issue earlier.
I'm using the GeckoFX winforms control in a .Net app to display a Predix Platform app. Not all of the components in the page are rendering, and the Javascript redirects aren't working. But everything loads fine in the latest version of Firefox.
Note that I'm using the binaries from https://www.nuget.org/packages/GeckoFX/ instead of initializing Xpcom using the Firefox dir. If I point Xpcom to my Firefox dir I get these errors:
Gecko.Xpcom.DirectoryServiceProvider.GetFile: not implemented:
permissionDBPDir A first chance exception of type
'System.Runtime.InteropServices.COMException' occurred in
Geckofx-Core.dll Error: 6/12/2017 10:10:09
AMMainUnhandled
Exception: Class not registered (Exception from HRESULT: 0x80040154
(REGDB_E_CLASSNOTREG)) Audit: 6/12/2017 10:10:09
AMMainStack
Trace: at Gecko.nsIServiceManager.GetServiceByContractID(String
aContractID, Guid& aIID) at
Gecko.Xpcom.GetService[TInterfaceType](String contractID) in
D:\temp\ddfb20c\Geckofx-Core\Xpcom.cs:line 745 at
Gecko.DefaultPromptFactory.Init() in
D:\temp\ddfb20c\Geckofx-Core\PromptService.cs:line 79 at
Gecko.PromptFactoryFactory.Init() in
D:\temp\ddfb20c\Geckofx-Core\PromptService.cs:line 60 at
Gecko.Xpcom.Initialize(String binDirectory) in
D:\temp\ddfb20c\Geckofx-Core\Xpcom.cs:line 381 at
XiboClient.MainForm.InitializeXibo() in
c:\Users\220023166\Documents\Visual Studio
2010\Projects\xibo-dotnetclient-1.8.1\MainForm.cs:line 165 at
XiboClient.MainForm..ctor() in c:\Users\220023166\Documents\Visual
Studio 2010\Projects\xibo-dotnetclient-1.8.1\MainForm.cs:line 156
at XiboClient.Program.RunClient() in
c:\Users\220023166\Documents\Visual Studio
2010\Projects\xibo-dotnetclient-1.8.1\Program.cs:line 136 at
XiboClient.Program.Main(String[] args) in
c:\Users\220023166\Documents\Visual Studio
2010\Projects\xibo-dotnetclient-1.8.1\Program.cs:line 118
Is there a security setting or something I might be missing in order to get this to work? Or is there a way I can view the webpage console through GeckoFX? I've inspected the page with Fiddler and it looks like all of the elements are loading correctly.
It's needed to select the second item from the drop-down menu that is hidden by default. The problem it that it works fine in Fire Fox 41 browser but not in Internet Explorer 11. I'm using Selenium Web Driver with C#, nUnit in Visual Studio 2010. Tests are executed on remote VM with Selenium Server and IEDriver.
HTML looks like:
<ul id="CVC" class="buttonMenu" style="visibility: hidden; left: 183px;">
<li class="menuItem">First</li>
<li class="menuItem">Second</li>
<li class="menuItem">Third</li>
</ul>
I have C# code that works only in FireFox:
var menu = wd.FindElement(By.Id("CVC"));
var menuLi = menu.FindElements(By.TagName("li"));
menuLi[1].Click();
wd.FindElement(By.Id("TITLE")).SendKeys("blabla"); //continue to work with appeared pop-up
wd.FindElement(By.Id("CVC_OK")).Click();
When I run test in Internet Explorer an error appears:
Test Name: Bookmark
Test FullName: EEE.Tests.BT.BB
Test Source: d:\Selenium\Automation\EEEAutomation\EEEAutomation\Tests\BT.cs : line 19
Test Outcome: Failed
Test Duration: 0:00:39.319
Result Message: OpenQA.Selenium.ElementNotVisibleException : Cannot click on element (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 35 milliseconds
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: 'wkqacl0801', ip: '10.101.6.104', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_60'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, pageLoadStrategy=normal, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:39901/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
Session ID: 6f09c88a-bd73-4cab-9312-0587c8345023
Result StackTrace:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at EEE.Tests.SubTests.CreateBBSubTest.Execute(IWebDriver wd) in d:\Selenium\Automation\EEEAutomation\EEEAutomation\Tests\SubTests\CreateBBSubTest.cs:line 103
at EEE.Tests.BT.BB() in d:\Selenium\Automation\EEEAutomation\EEEAutomation\Tests\BT.cs:line 54
Does anyone know how to make it worked in Internet Explorer 11?
Not sure if IE should be considered as a real browser. In any case I reread your problem, it seems that you expect IE to work like a browser on click event. In that case you might want to help it along :
using (var wd = new InternetExplorerDriver(
new InternetExplorerOptions {EnableNativeEvents = false}))
{
//your code
}
I figured out the solution by using JavaScript. I'm not sure that this is the best solution but at least it works not only in FF, but also in IE browser:
((IJavaScriptExecutor)wd).ExecuteScript("$('#CVC li:eq(1)').click()");
wd.FindElement(By.Id("TITLE")).Clear();
wd.FindElement(By.Id("TITLE")).SendKeys("blabla");
wd.FindElement(By.Id("CVC_OK")).Click();
This worked for me:
_driver.FindElement(By.Id("IdOfControl")).SendKeys(value);
I am trying to clone a git repository from the local file system:
using System;
using LibGit2Sharp;
class Program
{
static void Main()
{
var sourceUrl = #"file:///c:/work/libgit2sharp";
using (Repository.Clone(sourceUrl, "targetDir", bare: true))
{
Console.WriteLine("repository successfully cloned");
}
}
}
and I get an exception:
Unhandled Exception: LibGit2Sharp.LibGit2SharpException: An error was raised by libgit2. Category = Odb (Error).
Failed to find the memory window file to deregister
at LibGit2Sharp.Core.Ensure.Success(Int32 result, Boolean allowPositiveResult) in c:\work\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 85
at LibGit2Sharp.Core.Proxy.git_clone_bare(String url, String workdir, git_transfer_progress_callback transfer_cb) in c:\work\libgit2sharp\LibGit2Sharp\Core\Proxy.cs:line 219
at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, Boolean bare, Boolean checkout, TransferProgressHandler onTransferProgress, CheckoutProgressHandler onCheckoutProgress) in c:\work\libgit2sharp\LibGit2Sharp\Repository.cs:line 431
at Program.Main() in c:\work\ConsoleApplication1\Program.cs:line 10
I've also tried the following source url:
var sourceUrl = #"c:\work\libgit2sharp\.git\";
and got another exception:
Unhandled Exception: LibGit2Sharp.LibGit2SharpException: An error was raised by libgit2. Category = Config (Error).
Failed to parse config file: Unexpected end of file while parsing multine var (in c:/work/ConsoleApplication1/bin/Debug/targetDir/config:23, column 0)
at LibGit2Sharp.Core.Ensure.Success(Int32 result, Boolean allowPositiveResult) in c:\work\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 85
at LibGit2Sharp.Core.Proxy.git_clone_bare(String url, String workdir, git_transfer_progress_callback transfer_cb) in c:\work\libgit2sharp\LibGit2Sharp\Core\Proxy.cs:line 219
at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, Boolean bare, Boolean checkout, TransferProgressHandler onTransferProgress, CheckoutProgressHandler onCheckoutProgress) in c:\work\libgit2sharp\LibGit2Sharp\Repository.cs:line 431
at Program.Main() in c:\work\ConsoleApplication1\Program.cs:line 12
targetDir is never created.
If on the other hand I use HTTP transport, the Repository.Clone method works fine:
var sourceUrl = "https://github.com/libgit2/libgit2sharp";
So my question is if I am doing something wrong or if this is unsupported feature or a bug in the native git2.dll?
So my question is if I am doing something wrong or if this is unsupported feature or a bug in the native git2.dll?
A bit a both, actually.
The first exception is clearly a bug. This should not happen and will be troubleshot.
The second one requires a deeper analysis. Would you be so kind as to open a issue in the LibGit2Sharp project?
Good news are that a pull request from BenStraub was recently merged. This pull request implements the local fetch transport which should pretty solve the issue.
LibGit2Sharp will be updated in the following days with a new a new version of libgit2 binaries which should allow you perform a local clone/fetch. I'll update this answer as soon as it's been done.
Update
This test shows how do to a Clone and a Push over against a local repository.