Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page objects issue #2881

Closed
cambiph opened this issue Jan 28, 2016 · 1 comment
Closed

Page objects issue #2881

cambiph opened this issue Jan 28, 2016 · 1 comment

Comments

@cambiph
Copy link

cambiph commented Jan 28, 2016

Hello everyone,

I seem to be stuck in the construction of page objects.
I read a lot of docs about page objects and know that they contain two things:

  • elements that are present on a page
  • functions to interact with the page

When I check example files I see that the elements are defined in the beginning of each page object.
The in the test, the pageobject is imported via require.
But the problem I see there is that the objects aren't yet present when the require happens.
Is there another way to solve this without having to do a require just when the page is loaded?

Thanks inadvance.
Regards

@NickTomlin
Copy link
Contributor

Hi there!

I'm not quite clear on what your question is, but i'll attempt a quick answer. If you are using page objects in your tests they should be required and resolved when your test file is required. I'm going to assume you are talking about selecting an element on the page when your page object is required. You should not be selecting elements when your page object is required, instead wrap the selection in a function that can be invoked after protractor has started/the page is loaded.

If that hasn't answered your question, Please ask a question there with the 'protractor' tag or post in the Gitter Channel to get help.

From the the getting help section of the README:

Please ask usage and debugging questions on StackOverflow (use the "protractor" tag) or in the Angular discussion group. (Please do not ask support questions here on Github.)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants