/** * Copyright 2018 Google Inc. All rights reserved. * Modifications copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { test as it, expect } from './pageTest'; it.skip(({ isAndroid }) => isAndroid); it('should work', async ({ page, server, browserName, headless, isLinux }) => { it.fixme(browserName === 'firefox' && !headless && !isLinux); await page.setViewportSize({ width: 500, height: 500 }); await page.goto(server.PREFIX + '/grid.html'); const elementHandle = await page.$('.box:nth-of-type(13)'); const box = await elementHandle.boundingBox(); expect(box).toEqual({ x: 100, y: 50, width: 50, height: 50 }); }); it('should handle nested frames', async ({ page, server }) => { await page.setViewportSize({ width: 616, height: 500 }); await page.goto(server.PREFIX + '/frames/nested-frames.html'); const nestedFrame = page.frames().find(frame => frame.name() === 'dos'); const elementHandle = await nestedFrame.$('div'); const box = await elementHandle.boundingBox(); expect(box).toEqual({ x: 24, y: 224, width: 268, height: 18 }); }); it('should get frame box', async ({ page, browserName }) => { it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/10977' }); await page.setViewportSize({ width: 200, height: 200 }); await page.setContent(` `); const elementHandle = await page.$('iframe'); const box = await elementHandle.boundingBox(); expect(box).toEqual({ x: 0, y: 0, width: 300, height: 500 }); }); it('should handle scroll offset and click', async ({ page, server }) => { await page.setContent(`