Can you please give an example, how the page object is called and initialized?
Avinash Kumar <[email protected]> schrieb am Fr., 12. Juni 2020, 07:01: > Hi, >> Thanks for your reply. >> This was not my exact concern. I will explain in little clear way.. >> >> I have created a framework and in one package "Pages" i have created all >> groovy page class (POM) where in all page class under "Pages" package , >> i have used extends page and in this all waitFor method works fine for me. >> >> example:- >> >> package pages >> >> import geb.Browser >> import geb.Page >> import opt.* >> >> >> >> class Login extends Page { >> >> >> static at = {title == "Login"} >> >> static content = { >> // login form... >> usernameField {$('input#username')} >> passwordField {$('input#password')} >> logInButton {$('button#login-submit')} >> logoutButton {$("button", onclick : "logout();")} >> slide { $("div#myCarousel") } >> langField(wait:true) {$('a#lang')} >> >> } >> >> def "login To App"(username, password) { >> try { >> OperationUtil operationUtil = new OperationUtil(); >> >> waitFor(60) { >> operationUtil.enterVal(usernameField, username); >> operationUtil.enterVal(passwordField, password); >> } >> >> operationUtil.clickAnElement(logInButton) >> >> waitFor(Integer.parseInt(ju.getJsonValue("maxWait"))) { >> logoutButton.displayed >> slide.displayed } >> } >> catch(Exception e){ >> new ExceptionHandler().customizedException("Cannot login into >> the application"); >> e.printStackTrace(); >> } >> } >> } >> >> In other package, i have created one groovy class "OperationUtil" and i >> have used extend Page. >> >> Example: >> >> package opt >> >> import geb.Page >> >> class OperationUtil extends Page { >> >> >> def clickAnElement(objName){ >> waitFor(60) { >> objName.click() >> } >> >> } >> >> >> >> } >> >> >> when i run the code , code fails at waitFor(60) point under OperationUtil >> class >> and waitFor of "Login" class works fine for me. >> >> i get the below mentioned error: >> >> "2020-06-12 10:24:06 ERROR - Issue with login: Instance of page class >> modules.OperationUtil has not been initialized. >> Please pass it to Browser.to(), Browser.via(), Browser.page() or >> Browser.at() before using it. >> >> 2020-06-12 10:24:06 ERROR - Issue with login: Instance of page class >> modules.OperationUtil has not been initialized. >> Please pass it to Browser.to(), Browser.via(), Browser.page() or >> Browser.at() before using it. >> >> geb.error.PageInstanceNotInitializedException: Instance of page class >> modules.OperationUtil has not been initialized. >> Please pass it to Browser.to(), Browser.via(), Browser.page() or >> Browser.at() before using it." >> >> >> Regards, >> Avinash Kumar >> >> -- > You received this message because you are subscribed to the Google Groups > "Geb User Mailing List" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/geb-user/CAMMvVTSca9H5VJXz%3DwKQ2S%2BQtNe6%3DQKgTory6xyW0tPARwO2Cg%40mail.gmail.com > <https://groups.google.com/d/msgid/geb-user/CAMMvVTSca9H5VJXz%3DwKQ2S%2BQtNe6%3DQKgTory6xyW0tPARwO2Cg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/CALYktxPj0_vrX1_a3%3DcW48dNZtm1hs1b93rWu2uh%3DA%3DUJ10Rsg%40mail.gmail.com.
