Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can protractor test a login that is not angular based

I am testing an application written predominantly in angularjs however some elements of the application are written in .NET C#, such as the login form.

My question is this.

Can I leverage Protractor and test my application fully with e2e testing.

I have tried using protractor and I am happy with it thus far. However I do not seem to be able to test a page that written in .NET. I am not sure if this is because protractor only tests the elements of an angular application or if it is the way I have written my tests.

I have tried searching for the elements in the page like the example below.

ptor.findElement(protractor.By.xpath('/html/body/div/div[1]/section/input')).sendKeys('xxx');

But this only returns an UnknownError: javascript error: cannot call method 'get' of undefined.

I know that this error means the elements are not visible on the page however I have placed a timeout in my test shown below

it('this is a test', function() {}, 10000);

all I reuire is to be able to add text to a dynamically created input box, created by Html.TextBoxFor()

like image 857
Ian Richards Avatar asked Aug 22 '13 14:08

Ian Richards


1 Answers

After placing the issue on github I received the answer I was looking for. This can be found HERE!

Protractor requires that Angular be present on the page and the way around this is to use the driver directly. Following the link above should stear anyone stuck on the same issue in the right direction.

Kudos to JulieMR and the others who helped out with this issue.

like image 134
Ian Richards Avatar answered Oct 29 '22 23:10

Ian Richards