How to access the virutal document #document contents using playwright ? I tried using iFrame and Pagelocator. However, I am unable to reach document location.
Is there an option in Playwright to approach this? This is the page URL - https://sites.google.com/view/pinnednote/home
Yes, you have frame_locator
for python or frameLocator
for javascript.
Here an example in your page (Using python)
# Import needed libs
from playwright.sync_api import sync_playwright
# We initiate the playwright page
p = sync_playwright().start()
browser = p.chromium.launch(headless=False)
context = browser.new_context()
page = context.new_page()
# Navigate
page.goto("https://sites.google.com/view/pinnednote/home")
# We get the first iframe
iframe1 = page.frame_locator("//iframe[@jsname='WMhH6e']")
# We get the iframe inside the first iframe
iframe2 = iframe1.frame_locator("#innerFrame")
# We get the iframe inside the second iframe
iframe3 = iframe2.frame_locator("#userHtmlFrame")
# We print the title of this third iframe
print(iframe3.locator("//title").inner_text())
The page has a lot of iframes being honest.
About managing frames with playwright: Playwirght frameLocator