7. Browser, Context and Page Hierarchy in Java

Multi-Context Isolation in Java

BrowserContext buyerContext = browser.newContext(
    new Browser.NewContextOptions().setViewportSize(1280, 720)
);
Page buyerPage = buyerContext.newPage();
buyerPage.navigate("https://targetqa.com");

// Completely isolated second session:
BrowserContext adminContext = browser.newContext();
Page adminPage = adminContext.newPage();
adminPage.navigate("https://targetqa.com/admin");

Task

  • Implement isValidViewport:
  • 1. Accept int width and int height.
  • 2. Return true if width >= 1024 and height >= 768.
πŸ’‘Common doubts
Did you like the problem?
Lesson 7 of 18
Java
Loading code editor…
Next