After upgrading to v4 the switchTo behavior seems incorrect or at least inconsistent when working with nested iframes. The switch to iframe located on the top level works correctly and the context seems to be set properly.
I can verify and interact with elements within the first iframe. switchTo(nestedIframe) step passes but after that it seems to get into a state where nothing is visible to the driver any more. The elements present in nested iframe are never detected, neither are those within the first frame or on top-level outside of any frames.
Tested with codeceptjs@4.1.0 and playwright-core@1.61.1. Reproduction script:
Scenario('iframe test', ({ I }) => {
I.amOnPage('https://www.dezlearn.com/nested-iframes-example/')
I.waitForElement('#parent_iframe', 10)
I.switchTo('#parent_iframe')
I.waitForElement('#u_5_5')
I.waitForElement('#iframe1')
I.switchTo('#iframe1')
I.waitForElement('#u_5_6') // fails on v4
// below 2 calls are expected to fail with expected switchTo behavior but are included just to show that context seems broken
// I.waitForElement('#u_5_5') // located in parent iframe
// I.waitForElement('#parent_iframe') // located on top level
})
On the other hand doing the same thing using within seems to work but that has its own downsides so I'm not keen on relying solely on that.
Scenario('iframe test', ({ I }) => {
I.amOnPage('https://www.dezlearn.com/nested-iframes-example/')
I.waitForElement('#parent_iframe', 10)
within({ frame: ['#parent_iframe', '#iframe1'] }, () => {
I.waitForElement('#u_5_6')
})
})
This seems to be regression as it works fine on 3.7.9
After upgrading to v4 the switchTo behavior seems incorrect or at least inconsistent when working with nested iframes. The switch to iframe located on the top level works correctly and the context seems to be set properly.
I can verify and interact with elements within the first iframe.
switchTo(nestedIframe)step passes but after that it seems to get into a state where nothing is visible to the driver any more. The elements present in nested iframe are never detected, neither are those within the first frame or on top-level outside of any frames.Tested with
codeceptjs@4.1.0andplaywright-core@1.61.1. Reproduction script:On the other hand doing the same thing using within seems to work but that has its own downsides so I'm not keen on relying solely on that.
This seems to be regression as it works fine on 3.7.9