After submit, the next page can be of several PO types

15 views
Skip to first unread message

Joel

unread,
May 12, 2014, 7:17:15 AM5/12/14
to wtfra...@googlegroups.com
Hi,

i'm having some trouble getting over this problem:

On submitting Page1PO, the resulting page can be of 2 PO, Page2PO or Page3PO.

Currently, after the Page1PO.submit() i'm doing "wait_until_page_loaded", but that only works for a specific PO and not multiple.

I have no control over when the Page2PO or Page3PO is shown.

How can i overcome this?

Should i do this on the test, assume the result PO is Page2PO and if it's not, check if it's Page3PO? It doesn't seem a good option.


thanks,
Joel

joel.al...@gmail.com

unread,
May 12, 2014, 10:57:12 AM5/12/14
to wtfra...@googlegroups.com
Resolved it.


wait_until_page_loaded can get a list of POs and return the ones that validate.

David Lai

unread,
May 12, 2014, 1:54:16 PM5/12/14
to wtfra...@googlegroups.com
Best way to handle this is to use an Interface, have both page object type implement the same interface, and use the page object factory or wait_until_page_loaded utility with the interface instead of the class itself.

Here's an example of how to do that,

In the example, both the yahoo and google search page implement the same interface.  Then I use, search_page = PageFactory.create_page(ISearchPage, webdriver), and it'll return the correct page type.

The PageUtil.wait_until_page_loaded() is basically a pass through to PageObjectFactory.create() with a wait wrapper around it. So all the parameters you can pass to PageObjectFactory can also be used with PageUtil.wait_until_page_loaded().
Reply all
Reply to author
Forward
0 new messages