Skip to content

Commit

Permalink
fix: switchTo
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent committed Sep 26, 2023
1 parent 015505d commit cbb069c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/helper/Playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -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=')) {
Expand Down
7 changes: 7 additions & 0 deletions test/helper/Playwright_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit cbb069c

Please sign in to comment.