Skip to content

protractor's browser.setLocation() does not work. #3536

@krotscheck

Description

@krotscheck

OS?

OSX

Versions.

angular-cli: 1.0.0-beta.22-1
node: 7.2.0
os: darwin x64
protractor: 0.17.9

Repro steps.

TL/DR version

Write an e2e test that uses browser.setLocation rather than browser.get. Even after initializing the angular application using the latter, the following error will be thrown:

InvalidElementStateError: invalid element state: Failed to execute 'querySelector' on 'Document': The provided selector is empty.
  (Session info: chrome=54.0.2840.98)
  (Driver info: chromedriver=2.24.417412 (ac882d3ce7c0d99292439bf3405780058fcca0a6),platform=Mac OS X 10.12.1 x86_64)

ng init setup

This setup demonstrates how the error is thrown, even though it initializes an app without any serious routing.

ng init
mkdir src/assets
touch src/favicon.ico
npm start

# New console window

# Run webdriver-manager update
npm run pree2e
protractor --elementExplorer
browser.setLocation('test');

The log given by the failure.

See above. The exception in question exists within the selenium-webdriver code.

Mention any other details that might be useful.

How it should work:

# Do not execute in a project directory.
protractor --elementExplorer
browser.get('http://angular.github.io/protractor/#/tutorial');
browser.setLocation('api');
browser.setLocation('protractor-setup');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions