Skip to content
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

isVisible() is always returning false when used along with text("<text_of_a_element>") #2607

Open
gokultw opened this issue Jun 17, 2022 · 2 comments

Comments

@gokultw
Copy link

gokultw commented Jun 17, 2022

Describe the bug
isVisible() is always returning false when used along with text("<text_of_a_element>").
await highlight(text("<text_of_a_element>")); is highlighting the element but isVisible() is returning false, if we use a selector like $, button, link etc then we are getting the expected result.

To Reproduce
Script to reproduce the behavior:

(async () => {
    try {
        await openBrowser();
        await goto("Google.com");
        await highlight(text("India"));
        await console.log(await text("India").isVisible());
    } catch (error) {
        console.error(error);
    } finally {
        await closeBrowser();
    }
})();

Expected behavior
isVisible() Should return true since the text is available and visible on the page.

Versions:

  • Taiko: 1.4.3
  • OS: MAC Os 12.4
  • Node.js: v14.19.1

Additional context
The below code snippet is working fine with $ instead of text

(async () => {
    try {
        await openBrowser();
        await goto("Google.com");
        await highlight(text("India"));
        await console.log(await $("//DIV[text()='India']").isVisible());
    } catch (error) {
        console.error(error);
    } finally {
        await closeBrowser();
    }
})();
@jbpotonnier
Copy link

It looks like it may be a regression introduced by #2288

@ghost
Copy link

ghost commented Dec 10, 2022

@gokultw I have had the same issue while using Taiko. The problem in my case was that isVisible()returned false when the element I was looking for existed multiple times on the page. So this would be my first guess that the text India is found multiple times on the page but that the Xpath "//DIV[text()='India']" is unique and therefore isVisible() works correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants