Working with frame in Page Object Model using Selenium Webdriver

277 views
Skip to first unread message

devesh bhatt

unread,
Sep 3, 2015, 11:02:58 AM9/3/15
to webdriver

How would be work with frame in page object model with TestNG Framework in selenium Webdriver?


darrell

unread,
Sep 10, 2015, 12:14:37 PM9/10/15
to webdriver
It depends on how you define a 'page'. Generally speaking, a frame is another DOM. When you look at the DOM you will see that the <iframe> tag actually contains <html> ... </html>. Since tools like Selenium need to switch to the frame to be able to interact with it, it makes sense to treat it as a separate 'page'. When you instantiate the 'page' you need a method for how you 'switch' to the page. For actually different pages you use the driver.get() to switch to the page. For frames you use driver.get() to switch to the parent page then use switchTo() method to switch to the frame.
Reply all
Reply to author
Forward
0 new messages