Skip to content

[Bug] - The switchTo() throws error when passing the strict locator #3846

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kobenguyent opened this issue Sep 2, 2023 · 3 comments · Fixed by #3847
Closed

[Bug] - The switchTo() throws error when passing the strict locator #3846

kobenguyent opened this issue Sep 2, 2023 · 3 comments · Fixed by #3847

Comments

@kobenguyent
Copy link
Collaborator

What are you trying to achieve?

The switchTo() accepts the css locator.

What do you get instead?

The switchTo() throws error when passing the css locator

I.switchTo({ css: 'iframe[id^=number-frame]' })
    I switch to {"css":"iframe[id^=number-frame]"}
 ERROR  locator.toLowerCase is not a function
@das-en
Copy link

das-en commented Sep 7, 2023

I believe this is also impacting me using 'within'

await within({ frame: '.flex-1' }, async () => {
//iframe content
})

locator.toLowerCase is not a function

@kobenguyent
Copy link
Collaborator Author

kobenguyent commented Sep 8, 2023

thanks for your report @das-en I think #3847 also fixes that issue.

Screenshot 2023-09-08 at 06 56 00

Screenshot 2023-09-08 at 07 02 36

@kobenguyent
Copy link
Collaborator Author

kobenguyent commented Sep 8, 2023

    it('within should respect context in see when using frame with css locator', async function () {
      if (isHelper('TestCafe')) this.skip();

      await I.amOnPage('/iframe');
      await I._withinBegin({
        frame: { css: '#number-frame-1234' }, // support the strict locator
      });

      try {
        await I.see('Information');
      } catch (err) {
        if (!err) assert.fail('seen "Information"');
      }
    });

that fix also supports the strict locator

@kobenguyent kobenguyent changed the title [Bug] - The switchTo() throws error when passing the css locator [Bug] - The switchTo() throws error when passing the strict locator Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants