angular / protractor

E2E test framework for Angular apps
http://www.protractortest.org
MIT License
8.75k stars 2.31k forks source link

setSize is not a function #5183

Closed ASaiAnudeep closed 5 years ago

ASaiAnudeep commented 5 years ago

Latest version of protractor (6.0.0) is failing to run the following statement.

browser.driver.manage().window().setSize(1920, 1080);

Bug report

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['todo.spec.js']
};
describe('angularjs homepage todo list', function () {
  it('should add a todo', function () {
    browser.driver.manage().window().setSize(1920, 1080);
    browser.get('https://angularjs.org');

    element(by.model('todoList.todoText')).sendKeys('write first protractor test');
    element(by.css('[value="add"]')).click();

    var todoList = element.all(by.repeater('todo in todoList.todos'));
    expect(todoList.count()).toEqual(3);
    expect(todoList.get(2).getText()).toEqual('write first protractor test');

    // You wrote your first test, cross it off the list
    todoList.get(2).element(by.css('input')).click();
    var completedAmount = element.all(by.css('.done-true'));
    expect(completedAmount.count()).toEqual(2);
  });
});
Failures:
1) angularjs homepage todo list should add a todo
  Message:
    TypeError: browser.driver.manage(...).window(...).setSize is not a function
  Stack:
        at <Jasmine>
        at UserContext.<anonymous> (E:\Work\node\protractor-test\todo.spec.js:7:38)
        at <Jasmine>
        at runCallback (timers.js:794:20)
        at tryOnImmediate (timers.js:752:5)
        at processImmediate [as _immediateCallback] (timers.js:729:5)
cnishina commented 5 years ago

This is not an issue with Protractor but a change from Selenium. See https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/CHANGES.md

Per the selenium changelog:

Changes to lib/webdriver.Window (driver.manage().window()):
Added
- getRect
- setRect
- fullscreen
- minimize

Removed (use the getRect/setRect methods)
- getPosition
- setPosition
- getSize
- setSize

Closing since this is not a Protractor issue.