Search code examples
javascriptangularjsprotractorend-to-end

Automate End to End Test of Google.Com through Protractor


I am trying to make Protractor go to google.com and search a term.

  1. I have come to where protractor loads the non angular page Google and then puts the text in. How do I make it press "enter" or click the button?
  2. In addition I am not finding any guides on how to write protractor tests and the functions available? I am also new to JS and Angular. Should I learn more AngularJS concepts or Protractor Concepts?

spec.js:

browser.waitForAngularEnabled(false);
describe('Enter Search Term', function() {
 it('This will insert into the text field in google.com', function() {
 browser.get('www.google.com');
 element(by.xpath('//*[@id="q"]')).sendKeys('What is Protractor?');
  var query = element(by.xpath('//*[@id="q"]'));
expect(query = 'What is Protractor?');
browser.pause();
  });
});

conf.js:

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['spec.js']
};

Solution

  • Mapping the page links by xpath does the job.

    https://github.com/SDasman/Angular_Protractor_End2End_Tests/tree/master/Protractor_Google