1

I've got an angular 1 application where HTML has a little code snippet that declares global variable at the very beginning:

pathLanguage = "...";

The value of this variable depends on the URL given (parameters of the URL determine value of this variable). I would like to use protractor to check that value. Given the URL, how can I achieve that with protractor? Is it possible at all?

it("Open page", () => {
  browser.get(myURL);
  // ?
});

1 Answer 1

1

You could use executeScript to get the variable:

it("Open page", () => {
  browser.get(myURL);
  expect(browser.executeScript("return window.pathLanguage;")).toEqual(...);
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.