protractor icon indicating copy to clipboard operation
protractor copied to clipboard

browser.get doesn't refresh page using IE driver on IE 11

Open DK15 opened this issue 10 years ago • 4 comments

I am performing cross browser testing on windows 2012 server R2 and IE 11 combination. The protractor tests are on a linux machine and am executing those on windows VM.

My protractorConf.js file looks like below

seleniumAddress: 'http://<windows VM ip>:4444/wd/hub' baseUrl: 'http://<linux VM ip>:8000' capabilities: { browserName: 'internet explorer', platform: 'ANY', version: '11'}

I also have configured the security settings as prescribed here : https://code.google.com/p/selenium/wiki/InternetExplorerDriver

The test which fails shows error as : Error : AddCompanySuite should redirect to email sent page on successful added company account - Expected 'http://10.81.78.137:8000/#/addCompany' to match /.*#\/emailSent/.

On firefox, before, the test ‘Should redirect to email sent page on successful added company account’ is executed, the screen is refreshed and clears the inputs present in all the fields. Protractor then enters valid inputs in all fields, clicks Add which redirects users towards email sent page.

But on IE 11, before the test ‘Should redirect to email sent page on successful added company account’ is executed, the screen is not refreshed, fields are not cleared and protractor enters input values on the fields again which already has existing values from the test ‘Should disable create new account button before all inputs are valid’. Hence, the ‘Add’ button is shown as disabled. The screen looks like below : ie11

Hence, protractor fails the test by saying ‘addCompany’ doesn’t match with ‘emailSent’ url.

Here is the code which is executed

//3. email addresses do not match
    addCompanyPageObj.email.clear();
    addCompanyPageObj.email.sendKeys(badEmail1);
    addCompanyPageObj.retypeEmail.clear();
    addCompanyPageObj.retypeEmail.sendKeys(retypeEmail);
    browser.sleep(5000);
expect(addCompanyPageObj.emailMatchMsg.getText()).toContain(translations.ACCOUNT.TIPS.EMAIL_MATCH);
    expect(addCompanyPageObj.registerButton.getAttribute('disabled')).toBeTruthy();
    browser.sleep(5000);
   });```

  fit('should redirect to email sent page on successful added company account', function () {
  browser.sleep(10000);
    addCompanyPageObj.companyName.sendKeys(companyName);

    addCompanyPageObj.email.sendKeys(email);

    addCompanyPageObj.retypeEmail.sendKeys(retypeEmail);
    browser.pause();

    global.setHttpReturnStatus(mockDataSource, '201');
    global.scrollIntoViewAndClick(addCompanyPageObj.registerButton).then(function() {
      browser.getCurrentUrl().then(function (url) {
        expect(url).toMatch(/.*#\/emailSent/);

Note : Selenium standalone server version is 2.48.2
          IEdriver version is 2.48

I am starting the selenium server from command prompt as : java -jar selenium-sevrer-standalone-2.48.2.jar -port 4444 -Dwebdriver.ie.driver="C:\<path of IEdriver\IEDriverServer.exe"

Please advise on this issue if you guys have encountered this before and a possible solution on this.

@juliemr ; @elgalu 

DK15 avatar Jan 18 '16 17:01 DK15

I don't see from your code where the page is supposed to be refreshed. There is no call to browser.get in the code you've pasted here - could you review and add a test case that will reproduce your error?

juliemr avatar Jan 19 '16 22:01 juliemr

@juliemr

There's a function named 'beforeEach' which reloads the page using *addCompanyPageObj.get(), like below,

var AddCompany = function () {
  this.companyName = element(by.model('newCompanyObject.companyName'));
  this.email = element(by.model('newCompanyObject.email'));
  this.retypeEmail = element(by.model('newCompanyObject.retypeEmail'));
  this.emailInvalidMsg = element(by.model('errorMsg.emailValid'));
  this.emailMatchMsg = element(by.model('errorMsg.emailMatch'));
  this.emailHelpMsg = element(by.model('msg.emailHelp'));
  this.registerButton = element(by.id('registerButton'));
  this.alert = element(by.id('alert-0'));

  // Add Company page URL
  this.get = function () {
    browser.get('#/addCompany');
  };
};

module.exports = new AddCompany();

Hope this helps.

DK15 avatar Jan 19 '16 23:01 DK15

I think I found out that the issue may not be related to page refresh. Per my findings, the app is not reading the JSON file correctly, and is now parsing and showing only first block of the JSON file. I changed the order of the JSON data and put my required data at top of the JSON file, ran the test which took it correctly.

DK15 avatar Jan 20 '16 21:01 DK15

Sounds like this was a problem specific to your application then. Glad you solved it! Closing as fixed.

juliemr avatar Jan 21 '16 20:01 juliemr