Search code examples
seleniumwebdrivergeb

Geb - Transitioning to new page on button click inside an iFrame


I am newbie to Geb. Sorry if my question is incorrect.

I am trying to click a button inside an iFrame of CompaniesListPage and trying to transition to AddCompanyPage.

With a regular button outside the iFrame, I am able to do a

loginButton (to: CompaniesListPage){$("input", id:"loginButton")} to transition from a LoginPage to CompaniesListPage on loginButton click.

However, with the button inside the iFrame, I don't know how to achieve this

On the CompaniesListPage, I tried this

static content={
        inner { $("#default_portal_select_company_page") 

            withFrame(inner){
                  addCompanyButton (to:AddCompanyPage) {$('input', id:'AddCompanyButton')}
            }
}

then I understood that my declaration of the addCompanyButton should be incorrect and all I wanted from that page was to click and go forward.

So, on the testcase, i did a

withFrame (inner){

    $('input', id:'AddCompanyButton').click()
}

this works. However, since the page has already moved to AddCompanyPage now and wanted to work on it, I tried page (AddCompanyPage)

This throws a

geb.error.UnresolvablePropertyException: Unable to resolve AddCompanyPage as content for CompaniesListPage, or as a property on it's Navigator context

PS : Please let me know if a trace would help.


Solution

  • To answer my own question, the geb.error.UnresolvablePropertyException is simply due to a missing import of the AddCompanyPage in the script. Stupid me.