paypal/SeLion

Question on iframes

Closed this issue · 1 comments

How do u use page yaml for a page containing iframes?

mach6 commented

Create a PageYAML file for the iframe content. Then, in the the test or a extended page object class, call Grid.driver().switchTo().frame( ... ) prior to interacting with the frame.

What I mean by extended page object class is a class file which extends the generated parent page object and contains the logic to switchTo the iframe.

Something like;

  # ParentPage.yml
  # yaml markup for the parent page
 # IframeOfParentPage.yml
 # yaml markup for the iframe
class ParentPageExt extends ParentPage {
   private IframeOfParentPage iframe = new IframeOfParentPage();

   public void doSomethingInTheIframe() {
     //call swtichTo, if the iframe doesn't already have focus
     //do something on the iframe page object.
   } 
}

Hope this helps!

I'm going to close this question but feel free to reply back or ask on gitter if you have further questions on this topic.