Udemy Playwright: Web Automation Testing From Zero to Hero: Difference between revisions

Jump to navigation Jump to search
m
Line 685: Line 685:


=== Drag & Drop with iFrames ===
=== Drag & Drop with iFrames ===
<nowiki>
test("drag and drop with iframe", async ({ page }) => {
  await page.goto("https://www.globalsqa.com/demo-site/draganddrop/")
  const frame = page.frameLocator('[rel-title="Photo Manager"] iframe')
  await frame
    .locator("li", { hasText: "High Tatras 2" })
    .dragTo(frame.locator("#trash"))
  // more precise control
  await frame.locator("li", { hasText: "High Tatras 4" }).hover()
  await page.mouse.down()
  await frame.locator("#trash").hover()
  await page.mouse.up()
  await expect(frame.locator("#trash li h5")).toHaveText([
    "High Tatras 2",
    "High Tatras 4",
  ])
})</nowiki>

Navigation menu