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

How to do when lots of page objects are in different directories? #8

Open
CTHakkas opened this issue Jul 18, 2017 · 3 comments
Open

Comments

@CTHakkas
Copy link

Hi,
My product is very complex, it has more than 100 pages, so I don't want to put all the page objects files in the same level's directory. I try to organize the page objects by function as below.
The folder structure:
demo
|-- resources
| |-- function1_folder
| | |-----func1_subfolder1
| | | |------page1
| | | |------page2
| | |-----func1_subfolder2
| | | |------page3
| | | |------page4
| | |-----page5
| |-- function2_folder
| | |-----page6
| | | ----page7
|-- results
|-- tests
|-- test1.robot
|-- test2.robot

I can execute my test cases when all the pages are in the same directory, but when I organize the pages as above, "The current page should be" keyword can't find the module name "page1" , "page2" and so on.
Can you tell me how to use this library to test the pages as show above, thank you very much.

@boakley
Copy link
Owner

boakley commented Jul 18, 2017 via email

@CTHakkas
Copy link
Author

@boakley , thank you very much for your answer. as you said "add ${CURDIR} to PYTHONPATH", can you give me an example, sorry, I am new for robot framework, in my opinion, ${CURDIR} is the directory of the testsuite, but the pages are not in this directory, so how to get the pages directory and how to add it to the PYTHONPATH, thank you very much.

@nashu2k
Copy link

nashu2k commented Nov 14, 2019

@CTHakkas - if you check this project's robotframework-pageobjectlibrary/demo/tests/demo.robot you can see there

*** Settings ***
# this is the only place where we have to hard-code a path;
# when config.py is loaded it will alter the path to include
# the resources folder.
Variables   ../resources/config.py

Library     PageObjectLibrary
Library     SeleniumLibrary
Library     Process

All you need to change is in config.py the path to your func1_subfolder2 and you should be able to add your own Library into robot

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

3 participants