bbaia / protractor-net Goto Github PK
View Code? Open in Web Editor NEWThe .NET port of Protractor, an E2E test framework for Angular apps
License: MIT License
The .NET port of Protractor, an E2E test framework for Angular apps
License: MIT License
I get this error when I am trying to send text to an element on a mobile app built using ionic:
System.NotImplementedException was unhandled by user code
HResult=-2147467263
Message=Not yet implemented. Please help us: http://appium.io/get-involved.html
Source=WebDriver
StackTrace:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteScriptCommand(String script, String commandName, Object[] args)
at OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteAsyncScript(String script, Object[] args)
at Protractor.NgWebDriver.WaitForAngular() in c:\Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\NgWebDriver.cs:line 364
at Protractor.NgWebDriver.FindElement(By by) in c:\Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\NgWebDriver.cs:line 279
at Protractor.NgWebDriver.OpenQA.Selenium.ISearchContext.FindElement(By by) in c:\Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\NgWebDriver.cs:line 304
at OpenQA.Selenium.Support.UI.ExpectedConditions.<>c__DisplayClass10.b__f(IWebDriver driver)
NgBy.Model("aa").ToString() == "OpenQA.Selenium.By"
NgBy.Model("aa").ToString() == "By model: 'aa'" // or similar
It would be good for diagnostics:
public static void AssertIsDisplayed(this IWebDriver driver, By by)
{
IWebElement el = driver.FindElement(by);
Assert.True(
el.Displayed,
$"Expected element [{by}] to be displayed, but it wasn't.");
}
After calling the methods `Back(),
Forward()``and``Refresh()`` the injected modules aren't re-injected before resuming angular and therefore they cannot be used again.
Safari on desktop and iOS both hang when attempting to load the page. It looks like it is hanging on the line that tests for angular.
I am getting a few scripts failing since the update, it seems to be pointing to a user directory called Bruno...
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Remote.RemoteWebElement.FindElements(String mechanism, String value) at OpenQA.Selenium.By.FindElements(ISearchContext context) at Protractor.NgWebElement.FindElements(By by) in c:\Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\NgWebElement.cs:line 215 at NgHtmlTable
1.<get_Rows>b__0(NgWebElement r) in c:\Users\Daniel Hitchcock\Documents\Visual Studio 2012\Projects\AutomationBase\AutomationBase\TableBuilder.cs:line 69
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Linq.Enumerable.First[TSource](IEnumerable
1 source, Func`2 predicate)
at AutomationBase.Accounts.ValuesCheck() in c:\Users\Daniel Hitchcock\Documents\Visual Studio 2012\Projects\AutomationBase\AutomationBase\TestMain.cs:line 2951
OK, i'm going to get back into this stuff this week I think so I decided to look back at what I was doing. I can see the Button is angular as it has the ng.click but rather then spying to see what the properties were I found it easier to just look for the text of the button as I can just read it off the page and for the Label you can see both the angular models are identical for both labels, except for the label itself. Can you let me know what your thoughts are if you have a minute. Thanks Bruno
“Search” Not LinkedLinked
Ran into this today. I have two bindings on a page I am testing:
{{p[0].Blah}}
{{p[0].BlahDescription}}
When I do the following, both of the above elements are found instead of the expected one:
var Blahs = row.FindElements(NgBy.Binding("p[0].Blah"));
Currently, Driver.Navigate().GoToUrl(url)
unconditionally throws an exception when presented with non-Angular page. This request is to support this situation somehow.
The only way I could think of to deal with this in my code is with somewhat ugly, swallowing exception code:
try
{
Driver.Navigate().GoToUrl(url);
}
catch (InvalidOperationException e)
{
// Ignore "Angular could not be found on the page" Protractor exception
Log.DebugFormat("Ignoring exception in navigation to {0}: {1}", url, e.Message);
}
And this is done in my general navigation routine that navigates to all pages.
My first thought was to do this: ((NgWebDriver) Driver).WrappedDriver.Navigate().GoToUrl(url)
, but this would completely bypass Protractor code that initializes pages after login. I can't just go and login either because login page is presented transparently to the application-under-test once per session.
I am trying to use protractor-net on an Angular 2 site which is also in Production mode, and protractor-net says that "angular is not defined".
Is there a way to switch an app from production mode to development mode when using protractor-net with an Angular 2 app?
I had a similar problem in Angular 1 and ran this command to switch from prod to debug mode:
((OpenQA.Selenium.IJavaScriptExecutor)((IWrapsDriver)instance).WrappedDriver).ExecuteScript("angular.reloadWithDebugInfo();");
While writing a test case I found out that NgWebDriver does not implement the IJavaScriptExecutor interface. Instead I have to grab the wrapped driver and cast it to IJavaScriptExecutor. This isn't ideal. If you'd like I could create a small pull request that fixes this.
System.InvalidCastException : Unable to cast object of type 'Protractor.NgWebDriver' to type 'OpenQA.Selenium.ITakesScreenshot'.
Hi,
I am using ngDriver.waitforangular for waiting the page to load after certain operation like user click. But it is not working all the time consistently. I have setscripttimeout to 100 seconds, but still after user click it throws sync error. The application is made out of angular 2. I want to know whether I am doing it in correct way or is there any other way to use it or to wait till page is loaded for angular 2 application.
Please help.
Thanks
In the readme file following information is included:
Supports Microsoft .NET Framework 3.5 and higher.
However, I wonder whether protractor-net
will be supported in .NET Core or are there any plans for that.
Hi bbaia,
I have few problems with NgBy.Bindings(). Here is the line that cause me headache :
ngDriver.FindElement(NgBy.Binding("::$ctrl.test"))
.
It seems NgBy.Bindings() needs the debug info that Angular provides by default. If you deactivate the Angular debug with
$compileProvider.debugInfoEnabled(false);
NgBy.Bindings() method doesn't work and can't find the element.
Could you please provide a solution as soon as possible, or I will be forced to deactivate End-to-End tests on my beloved project.
Regards,
Just wondering what the status or plans are for Angular 2 support?
ngDriver throws Angular could not be found on the page exception
Hi team - Can you please share step by step process to use protector with visual studio enterprise 2017.
and also please give the detailed steps to use this library as well in visual studio enterprise 2017.
The NgWebDriver class doesn't implement the Interface IWrapsDriver and the NgWebElement class doesn't implement IWrapsElement.
Therefore when trying to use the Actions class with the NgWebDriver an ArgumentException is thrown.
Hi Protractor-net Team,
I try to use your library to test Angular2 cli application but I have error every time.
Can I use this library to test Angular2?
Best Regards,
Stanislava
One request would be to add an NgBy that will find elements by model. Currently there are several options for finding elements by model but it appears that they are all html tag specific such as Inputs and Selects.
Are there any plans to add something like this?
If not, perhaps we could pull request in something generic like finding div tags by model and that could potentially cover a lot more use cases.
Protract 0.6
Firefox 39
Selenium grid 2.46.0
When trying to run tests on Firefox the following error occurs:
SetUp : System.InvalidOperationException : angular is not defined
I’ve never done a pull request before so I’m wondering if I did something wrong or if there is another reason why my request isn’t being merged into the parent branch of code? I see a lot of NgBy methods have been rendered obsolete by the Model method, the problem I have is some elements that don’t have that tag available such as button and label. So I added them and was hoping to get them into the next NuGet package so I can use them if possible.
When testing page which has its parts in Angular and parts in non-Angular, following code is valid in original protractor:
browser.ignoreSynchronization = true; browser.get("/home"); ... browser.ignoreSynchronization = false;
which would be simillar to .NET version:
var ngDriver = new NgWebDriver(driver); ngDriver.IgnoreSynchronization = true; ngDriver.Url = "/home"; ... ngDriver.IgnoreSynchronization = false;
however IgnoreSynchronization is ignored in Url = ".."
which leads to exception. I am not able to test the site when its page is not in Angular, but redirected to Angular page right after the login
Consider the following console application. The comments explain the observed and the expected behavior.
using (var ngDriver = new NgWebDriver(new ChromeDriver()))
{
ngDriver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(5));
ngDriver.Url = "http://www.angularjs.org";
ngDriver.FindElement(NgBy.Model("yourName")).SendKeys("Julie");
// Looking up a non-existing element via NgBy.
// This should throw as other locators do, but doesn't.
var element = ngDriver.FindElement(NgBy.Binding("yourName_notfound"));
// The following line crashes with a NullReferenceException
// at Protractor.NgWebElement.get_Text()
// in c: \Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\NgWebElement.cs:line 125
Console.WriteLine(element.Text);
}
Diagnosing NullReferenceException
s is not very convenient. Compare it to the exception thrown when searching by an unknown id:
An unhandled exception of type 'OpenQA.Selenium.NoSuchElementException' occurred in WebDriver.dll
Additional information: no such element: Unable to locate element: {"method":"id","selector":"yourName_notfound"}
I'm using protractor.net in a combined ASP.NET Core 1.x / Angular 5 Project, where it is working nicely.
After updating my Project to ASP.NET Core 2.0 I can't use protractor anymore. Protractor itself seems to be working, but I always get the following error in my Server:
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware: Error: An unhandled exception has occurred: Cannot find reference assembly 'Microsoft.Win32.Primitives.dll' file for package Microsoft.Win32.Primitives
System.InvalidOperationException: Cannot find reference assembly 'Microsoft.Win32.Primitives.dll' file for package Microsoft.Win32.Primitives
bei Microsoft.Extensions.DependencyModel.Resolution.ReferenceAssemblyPathResolver.TryResolveAssemblyPaths(CompilationLibrary library, List`1 assemblies)
bei Microsoft.Extensions.DependencyModel.Resolution.CompositeCompilationAssemblyResolver.TryResolveAssemblyPaths(CompilationLibrary library, List`1 assemblies)
bei Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths(ICompilationAssemblyResolver resolver, List`1 assemblies)
bei Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths()
bei Microsoft.AspNetCore.Mvc.ApplicationParts.AssemblyPart.<>c.<GetReferencePaths>b__8_0(CompilationLibrary library)
bei System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
bei Microsoft.AspNetCore.Mvc.Razor.Compilation.MetadataReferenceFeatureProvider.PopulateFeature(IEnumerable`1 parts, MetadataReferenceFeature feature)
bei Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateFeature[TFeature](TFeature feature)
bei Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorReferenceManager.GetCompilationReferences()
bei System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory)
bei Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorReferenceManager.get_CompilationReferences()
bei Microsoft.AspNetCore.Mvc.Razor.Internal.LazyMetadataReferenceFeature.get_References()
bei Microsoft.CodeAnalysis.Razor.CompilationTagHelperFeature.GetDescriptors()
bei Microsoft.AspNetCore.Razor.Language.DefaultRazorTagHelperBinderPhase.ExecuteCore(RazorCodeDocument codeDocument)
bei Microsoft.AspNetCore.Razor.Language.RazorEnginePhaseBase.Execute(RazorCodeDocument codeDocument)
bei Microsoft.AspNetCore.Razor.Language.DefaultRazorEngine.Process(RazorCodeDocument document)
bei Microsoft.AspNetCore.Razor.Language.RazorTemplateEngine.GenerateCode(RazorCodeDocument codeDocument)
bei Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CompileAndEmit(String relativePath)
bei Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CreateCacheEntry(String normalizedPath)
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
bei Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorPageFactoryProvider.CreateFactory(String relativePath)
bei Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.CreateCacheResult(HashSet`1 expirationTokens, String relativePath, Boolean isMainPage)
bei Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.OnCacheMiss(ViewLocationExpanderContext expanderContext, ViewLocationCacheKey cacheKey)
bei Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.LocatePageFromViewLocations(ActionContext actionContext, String pageName, Boolean isMainPage)
bei Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.FindView(ActionContext context, String viewName, Boolean isMainPage)
bei Microsoft.AspNetCore.Mvc.ViewEngines.CompositeViewEngine.FindView(ActionContext context, String viewName, Boolean isMainPage)
bei Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor.FindView(ActionContext actionContext, ViewResult viewResult)
bei Microsoft.AspNetCore.Mvc.ViewResult.<ExecuteResultAsync>d__26.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
bei Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeResultAsync>d__19.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
bei Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextResultFilterAsync>d__24.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
bei Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context)
bei Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
bei Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextResourceFilter>d__22.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
bei Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
bei Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
bei Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeFilterPipelineAsync>d__17.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
bei Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeAsync>d__15.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
bei Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
bei System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
bei Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.<Invoke>d__6.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
bei Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>d__6.MoveNext()
Has anyone successfully used protractor with ASP.NET Core 2 (and I'm just making some dumb mistake)? Or is this a general problem with ASP.NET Core 2 and protractor?
We use Angular 5.1 with the angular2-highcharts package. We do our tests with Selenium v3.9.0 and Protractor.net v0.11.0.
As soon as the tests navigate to a page which contains a highchart, I get the WebDriverTimeoutException.
So we
So we perform:
element.MoveAndClick();
to click a button and navigate to the next page (with the chart). Then we do the WaitForAngular:
((NgWebDriver)driver).WaitForAngular();
That's where the exception occurs:
OpenQA.Selenium.WebDriverTimeoutException: 'asynchronous script timeout: result was not received in 10 seconds
(Session info: chrome=64.0.3282.140)
(Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 10.0.16299 x86_64)'
------------
WebDriver.dll!OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(OpenQA.Selenium.Remote.Response errorResponse)
WebDriver.dll!OpenQA.Selenium.Remote.RemoteWebDriver.Execute(string driverCommandToExecute, System.Collections.Generic.Dictionary<string, object> parameters)
WebDriver.dll!OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteScriptCommand(string script, string commandName, object[] args)
Protractor.dll!Protractor.NgWebDriver.WaitForAngular()
If I remove the highcharts from my page, the tests work flawlessly.
If I set IgnoreSynchronization of the NgWebDriver to true and do the waiting myself, it will work. But when it's set to false again the next interaction with the page (e.g. FindElement) will fail with the same error, even if no more charts are visible.
This happens with Chrome and Internet Explorer 11.
Can I supply any more information to locate the problem?
Thanks!
I found that the NgBy.Binding
method wasn't finding some of my bound elements. I inspected further and it looks like the client side script needs an update to be more tolerant. I noticed the corresponding script in the Protractor project has been updated: https://github.com/angular/protractor/blob/673d416b7ef5abd0953da940cfa8cf2a59650df4/lib/clientsidescripts.js#L81
I can submit a PR for this if you want.
We're working with an app that has been updated to make a call to retrieve some data and then continue bootstrapping, so there is a small amount of time where the application may not be bootstrapped. This is causing issues when waitforangular() is called:
javascript error: [ng:test] http://errors.angularjs.org/1.5.11/ng/test
I'm wondering if there's a way built in to Protractor that would allow us to check to make sure the application is bootstrapped prior to trying to access any elements?
Hi
I have the ng-model = "userService.account" which is in side ng-app
Now when i give a try find elements like Driver.FindElement(NgBy.Model("userService.account")); the below exceptions throws.
But the code above to find elements by repeater works perfectly!! (the first 5 lines below.)
Gilgandra 15/16 Chickpeas - CHKP 933.5 mt $1,111.00 8 hours
Baan Baa 15/16 Barley - F1 1713 mt $11,111.00 8 hours
Ardlethan 15/16 Wheat - APH2 11 mt $2,222.00 5 days
Baan Baa 15/16 Barley - F2 755 mt $22,145.00 5 days
Then the this error for find by model
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteScriptCommand(String script, String commandName, Object[] args)
at OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteScript(String script, Object[] args)
at Protractor.JavaScriptBy.FindElements(ISearchContext context) in c:\Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\JavaScriptBy.cs:line 90
at Protractor.JavaScriptBy.FindElement(ISearchContext context) in c:\Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\JavaScriptBy.cs:line 49
at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by)
at CropConnect.TestScripts.UnitTest1.TestMethodForDemo() in C:\VisualStudio Projects\com.GrainCorp.SL\CropConnect\TestScripts\UnitTest1.cs:line 92
Is there any plans to release signed binaries as well as unsigned with the nuget package?
The current implementation of locators inside the static class NgBy
doesn't support the PageFactory
model. To support this, the methods inside NgBy
class must be replicated in separate classes that extend the type By
.
PageFactory model would look something like this.
[FindsBy(How = How.Custom, Using = "username", CustomFinderType = typeof(NgBinding)]
public IWebElement UsernameElement = null;
Are you already working on something similar to this? Or would you appreciate a PR ?
When refreshing it the driver doesn't wait for angular and therefore it can cause error when clicking on save buttons etc...
The function refresh should call the WaitForAngular method before refreshing
public void Refresh()
{
this.ngDriver.WaitForAngular();
this.navigation.Refresh();
}
Evaluate an Angular expression on the scope of the current IWebElement
.
I'm a bit new to the C# selenium webdriver, so let me know if this is covered elsewhere that I'm not aware of.
Currently, it's currently a bit difficult to run e2e tests against multiple browsers, even when you're wrapping a RemoteWebDriver that points to a selenium grid which supports multiple browsers. Current solutions I'm aware of involve using app.config or environment variables/etc... to run tests multiple times and dynamically create drivers/capabilities based on config.
Protractor for JavaScript supports the concept of multiple capabilities, which allows you to easily specify multiple target browsers to run in parallel in one test run:
https://github.com/angular/protractor/blob/master/spec/multiConf.js
It would be nice to have this support for Protractor.net as well. I'm not sure if you'd have multi-capabilities like the JS version or just allow us to pass in an IEnumerable of web drivers to wrap, instead of just one. I suspect the multi-driver option might be easier to configure (and probably to implement).
I'm using Protractor for .NET. Is there any reporter for it? There is a Protractor add-on "Protractor Html Screenshot Reporter". It works on Jasmine framework. Is there a way I can make it work in my protractor-net C# tests? Or is there any reporter available for "Protractor for .NET" that can be used to take screenshot of failed tests and generate HTML report with all test result similar to the way "Protractor Html Screenshot Reporter" does?
At the moment, if ngDriver.FindElement
doesn't find anything, it throws an error. This means that using it in Assert
statements is impossible. It would be really nice if one could do thing like this:
Assert.IsNotNull(ngDriver.FindElement(NgBy.Model("myModel")));
NgWebDriver.Url always returns the URL used to navigate to the Angular app.
IE Driver bug ?
The NgBy.Repeater locator needs to be tweaked to be able to find ng-repeat-start elements. This is a new-ish angular attribute and I've seen it used several places.
Anyone else having issues where explicit wait.Until(ExpectedConditions.blah...) are still needed? I'm using page objects and the PageFactory to initialize elements as in this project's example page object.
I've tried explicitly calling ngDriver.WaitForAngular() before and after element clicks, clears, .Text, .Count, etc. Following is an example that regularly fails due to not waiting sufficiently for ng-animate overlays to be cleared from the browser visibility:
[FindsBy(How = How.Custom, CustomFinderType = typeof(NgByBinding), Using = "p[0].RateDescription")]
private IList<IWebElement> lstRateDescriptions { get; set; }
public IEnumerable<string> ListOfRateDescriptions { get {
// ngDriver.WaitForAngular();
wait.Until(ExpectedConditions.ElementToBeClickable(lstRateDescriptions[0]));
return lstRateDescriptions.Select(r => r.Text); } }
Hi,
I've just updated Selenium version to 3.0 beta 2 , also downloaded required geckodriver (https://github.com/mozilla/geckodriver/releases) , and started testing with Firefox 47.0.1.
I noticed that - driver doesn't wait for angular request to finish & test fails. Can you please help ?
Let me know if any other additional info required.
This might be expected design. However, could there be a way to just ignore all the angular stuff and default to regular webdriver if angular is not found on page as opposed to forcing tester to figure it out per page.
Maybe there already is a way but i don't know how to turn it on.
Thanks
Result StackTrace:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteScriptCommand(String script, String commandName, Object[] args)
at OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteAsyncScript(String script, Object[] args)
at Protractor.NgWebDriver.WaitForAngular() in c:\Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\NgWebDriver.cs:line 367
at Protractor.NgWebDriver.OpenQA.Selenium.ISearchContext.FindElements(By by) in c:\Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\NgWebDriver.cs:line 316
...
System.InvalidOperationException: System.InvalidOperationException: javascript error: angular could not be found on the window
JavaScript stack:
Error: angular could not be found on the window
at eval (eval at executeAsyncScript (:438:5), <anonymous>:11:11)
at eval (eval at executeAsyncScript (:438:5), <anonymous>:22:5)
at executeAsyncScript (<anonymous>:438:26)
at <anonymous>:454:29
at callFunction (<anonymous>:346:33)
at <anonymous>:356:23
at <anonymous>:357:3
(Session info: chrome=55.0.2883.87)
(Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.10586 x86_64) (UnexpectedJavaScriptError).
This is pretty similar to http://stackoverflow.com/questions/21382962/when-running-protractor-with-phantomjs-browser-only-able-to-run-tests-once. Only one of my tests run on IE and after that all breaks. This issue is not reproducible on Firefox or Chrome
See here for detail.
http://stackoverflow.com/questions/28245166/protractor-and-ie11-navigation-issue
I want to wait for certain HTML elements on my page to become enabled, before we can click them.
They are disabled until certain ajax requests complete, and then they are ready to be clicked.
According to WebDriver there might be a way to do this with WebDriverWait. http://assertselenium.com/2013/01/29/webdriver-wait-commands/
Will you support WebDriverWait?
Or is there another way apart from Thread.Sleep()?
Selenium WebDriver supports .NET 3.5
It is really difficult to start using protractor-net. Doc is inexistant, readme example is cannot be used as is ([Test]... where does that come from...).
I have a scenario in which the page has to be scrolled up for a button click event. I have raised the same question in StackOverflow.com - http://stackoverflow.com/questions/31984385
Thanks in advance
I have the angular app with recaptcha in login form. So I switch driver to recaptcha frame and click on checkbox. After this I switch back to the parent frame, find element on main form- and at this moment waitforangular waiting for recaptcha reset script ends. So I need to skip this, it is possible?
Hi,
Are we supporting the edge browser. I am using below packages and getting error on running test with protractor :
Packages
"Protractor" version="0.9.1"
"Selenium.Support" version="2.53.1"
"Selenium.WebDriver" version="3.0.0"
"Selenium.WebDriver.ChromeDriver" version="2.25.0.0"
"Selenium.WebDriver.MicrosoftWebDriver" version="10.0.10240.0"
"WebDriver.IEDriverServer.win32" version="2.53"
Code:
private static IWebDriver driver;
private static NgWebDriver ngDriver;
driver = new EdgeDriver();
driver.Navigate().GoToUrl(ConfigurationManager.AppSettings.Get("ServerHost") + TestVariable.loginPath);
Thread.Sleep(1000);
driver.FindElement(By.Name("username")).Clear();
driver.FindElement(By.Name("username")).SendKeys("tenant1");
//With above step the action was performed but with below operation is not successful
ngDriver = new NgWebDriver(driver);
ngDriver.FindElement(By.Name("username")).Clear();
ngDriver.FindElement(By.Name("username")).SendKeys("tenant1");
Error:
Waiting for new request...
WebUI.Test.Entity.Feature.EntityFeature.ConfirmationMessageIsDisplayedAfterCreatingEntity_ [FAIL]
System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
---- System.NotImplementedException : not implemented
Stack Trace:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at BoDi.ObjectContainer.CreateObject(Type type, IEnumerable1 resolutionPath, RegistrationKey keyToResolve) at BoDi.ObjectContainer.TypeRegistration.Resolve(ObjectContainer container, RegistrationKey keyToResolve, IEnumerable
1 resolutionPath)
at BoDi.ObjectContainer.CreateObjectFor(RegistrationKey keyToResolve, IEnumerable1 resolutionPath) at BoDi.ObjectContainer.Resolve(Type typeToResolve, IEnumerable
1 resolutionPath, String name)
at lambda_method(Closure , IContextManager , String )
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)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(StepInstance stepInstance)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep()
at WebUI.Test.Entity.Feature.EntityFeature.ScenarioCleanup()
at WebUI.Test.Entity.Feature.EntityFeature.ConfirmationMessageIsDisplayedAfterCreatingEntity_()
----- Inner Stack Trace -----
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteScriptCommand(String script, String commandName, Object[] args)
c:\Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\NgWebDriver.cs(370,0): at Protractor.NgWebDriver.WaitForAngular()
c:\Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\NgWebDriver.cs(283,0): at Protractor.NgWebDriver.FindElement(By by)
at WebdriverBdd.TestConfiguration.get_Driver()
at WebUI.Test.Rome.StepDefination.ModelStepDefinition..ctor(RuntimeTestData testData)
Finished: WebUI.Test
Thanks
Amit
Please implement following items
Does not able to find elements using NgBy.Model("modelname") or NgBy.Binding("") for an application which is using manual bootstrap process. It is not using " ng-app " directive.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.