From cbb069c23c035edacafd3e1551a506c85793a6e1 Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Tue, 26 Sep 2023 11:04:05 +0200 Subject: [PATCH] fix: switchTo --- lib/helper/Playwright.js | 2 +- test/helper/Playwright_test.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/helper/Playwright.js b/lib/helper/Playwright.js index a1b7837e9..a738b4227 100644 --- a/lib/helper/Playwright.js +++ b/lib/helper/Playwright.js @@ -2558,7 +2558,7 @@ class Playwright extends Helper { // get content of the first iframe locator = new Locator(locator, 'css'); - if ((locator.frame && locator.frame === 'iframe') || locator.value.toLowerCase() === 'iframe') { + if ((locator.frame && locator.frame === 'iframe') || locator.value.toLowerCase() === 'iframe' || locator.value.toLowerCase().includes('iframe')) { contentFrame = await this.page.frames()[1]; // get content of the iframe using its name } else if (locator.value.toLowerCase().includes('name=')) { diff --git a/test/helper/Playwright_test.js b/test/helper/Playwright_test.js index 8f181603b..b2a72ca33 100644 --- a/test/helper/Playwright_test.js +++ b/test/helper/Playwright_test.js @@ -335,6 +335,13 @@ describe('Playwright', function () { I.switchTo(null); I.see('Iframe test'); }); + + it('should switch to iframe using css', async () => { + I.amOnPage('/iframe'); + I.switchTo('iframe#number-frame-1234'); + I.see('Information'); + I.see('Lots of valuable data here'); + }); }); describe('#seeInSource, #grabSource', () => {