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

Search term on playwright.dev not working when running the test #24

Open
Zorry-Serafimova opened this issue Jun 28, 2023 · 6 comments
Open
Assignees
Labels
help wanted Extra attention is needed pending question Further information is requested

Comments

@Zorry-Serafimova
Copy link

🐞 Describe the question:
I used codegen to grab the locators for the search exercise. However when I ran it from VS Code using the UI mode it successfully gets fills in the search term but it says there are no results available. my code can be found https://github.com/Zorry-Serafimova/tau-introduction-to-playwright-ts/blob/main/tests/search-test.spec.ts
and the page https://github.com/Zorry-Serafimova/tau-introduction-to-playwright-ts/blob/main/pages/search-term-page.ts
📸 Screenshots/GIFs/Videos:
If applicable, add screenshots to help explain your needs.
test-failed-1
🛝 Additional context:
Add any other context here.

🎡 A picture of your pet or a toy or something really cool:

@Zorry-Serafimova Zorry-Serafimova added help wanted Extra attention is needed pending question Further information is requested labels Jun 28, 2023
@Zorry-Serafimova
Copy link
Author

found a workaround where i click on the no result and then back into the search box, now it brings results but the arrowdown option is not working

@raptatinha
Copy link
Owner

Hi @Zorry-Serafimova
so sorry for the delayed response.
I believe this could be an issue on Playwright itself. This repo is only for the training issues. :)
Would you please report it on https://github.com/microsoft/playwright or on their discord channel: https://discord.com/servers/playwright-807756831384403968 (may be faster via discord).
Thank you for getting in touch!

@arickmm90
Copy link

This is still hapening to me, not working with any browser. Anyone knows why?

@raptatinha
Copy link
Owner

Hi @arickmm90,
would you please share more details about the issue you are facing?
If you could open a new issue here with your info, I'm happy to help you.
Thank you!

@flynnbops
Copy link

flynnbops commented Nov 8, 2023

I had similar issues, but not consistently. It's most likely a quirk of the playwright site search than an issue with your test.

May be worth trying a to interact with a simpler page as a comparison. e.g. do a search on google

Working sample code

I've provided a simple test implementation that seems fine for me. May be useful to you.

test.describe('Playwright search function', () => {
    test('Search for JavaScript', async ({page}) => {
        await page.goto('https://playwright.dev/');
        
        //Enter a search term.
        await page.getByRole('button', { name: 'Search' }).click();
        await page.getByPlaceholder('Search docs').fill("JavaScript");

        // Choose a search result.
        await page.getByRole('link', { name: 'Introduction​ Evaluating JavaScript' }).click();

        //Simple assertion we are on the correct new page.
        await expect(page).toHaveTitle('Evaluating JavaScript | Playwright');
    });
});

@coding-umr
Copy link

If it is inconsistent or not getting results, it would be an issue from the playwright's website.

I am working on the search exercise and I do not see this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed pending question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants