Page load timeouts

Here is my conf file:

// An example configuration file.
exports.config = {
  // The address of a running selenium server.
  seleniumAddress: 'http://localhost:4444/wd/hub',

  // Capabilities to be passed to the webdriver instance.
  capabilities: {
    'browserName': 'phantomjs',
    'phantomjs.binary.path': 'C:/Users/MY_USER_NAME/AppData/Roaming/npm/node_modules/phantomjs/phantomjs.exe'
  },

  // Spec patterns are relative to the current working directly when
  // protractor is called.
  specs: ['example_spec.js'],

  // Options to be passed to Jasmine-node.
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000
  }
};

And here is my example_spec.js file

describe('angularjs homepage', function() {
  it('should greet the named user', function() {
    browser.get('http://www.angularjs.org');

    element(by.model('yourName')).sendKeys('Julie');

    var greeting = element(by.binding('yourName'));

    expect(greeting.getText()).toEqual('Hello Julie!');
  });
});  

When I run it, I always get an error:

Error: Timed out waiting for page to load Wait timed out after 10129ms

If I switch to testing only chrome, it works fine, but I can't get phantomjs to work. I have the latest build of both phantomjs and the protractor just installed.

+4
source share
1 answer

It turns out two things were raised.

1) The corner site just did not want to work

2) You need to set browser resolution using phantomjs, if the default is not set: browser.driver.manage().window().setSize(1124, 850);

I ran this in mine before each:

beforeEach(function(){
    browser.driver.manage().window().setSize(1124, 850);
});

And then I started taking tests that pass.

+4
source

Source: https://habr.com/ru/post/1544184/


All Articles