New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can protractor test a login that is not angular based #51
Comments
Angular needs to be available on the page in order for Protractor to work. If Angular isn't available on the page you'll need an instance of // ptor variable is set in the before function
it('test if div appears', function() {
ptor.driver.get('/Test/Index');
ptor.driver.findElement(protractor.By.xpath('/html/body/div/div[1]/section/input')).sendKeys('whatever');
ptor.driver.findElement(protractor.By.xpath('/html/body/div/div[1]/section/input')).getAttribute('value')
.then(function(value) {
expect(value).toEqual('whatever');
});
}); |
In my project I have a unit test to login into the application. The login page is not an angular app. This is the first test listed in the specs: [] attribute of the config file. Here is my implementation: var protractor = require('protractor');
require('../node_modules/protractor/jasminewd');
var config = require('../settings.js').getConfig();
describe('login', function() {
it('should login', function() {
var ptor = protractor.getInstance();
var driver = ptor.driver;
var findByName = function(name) {
return driver.findElement(protractor.By.name(name));
};
driver.get(config.url);
findByName('Email').sendKeys(config.user);
findByName('Passwd').sendKeys(config.password);
findByName('signIn').click();
});
}); |
Yup, the correct way to do this is to use the webdriver directly. It can be grabbed from a protractor instance as |
More recently, it's available as
|
So, do you all see many users of protractor not using Angular? |
@wayneseymour In our case, we have a non-Angular login page we need to get through before we can start testing the Angular parts. |
@tfnico thanks for the response. Well I've been eval-ing a handful of JS libs for e2e testing and Protracotr seems solid, but we are not using angular (yet). Do you think I should? |
@wayneseymour I don't think this discussion belongs in a closed issue. Please ask on the Angular mailing list instead: |
@tfnico My apologies, you are right...and thanks. :) |
@tfnico. Thank u very much. it worked |
ghyjfj |
Great solution!! Thanks |
Hi , describe('cct homepage',function(){ protractor is unable to locate element. Can you help me with this issue ? |
@ProtHelp please ask a question on stackoverflow with the 'protractor' tag or post in the Gitter Channel to get help. From the the getting help section of the README:
|
I am trying to use browser.driver and it throws the exception saying driver is not defined. Can someone suggest how to debug further |
I am having the same error too, i cant find browser.driver :( |
This question is on stackoverflow.
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 to see if this helps. I have also tried sleep(5000) but this doesn't help either.
it('test if div apears', function () {
ptor = protractor.getInstance();
ptor.get('/Test/Index');
var text = ptor.findElement(protractor.By.xpath('/html/body/div/div[1]/section/input')).sendKeys('xxx');
expect(text).toEqual('Index');
}, 10000);
all I require is to be able to add text to a dynamically created input box, created by Html.TextBoxFor()
The text was updated successfully, but these errors were encountered: