microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
67.14k stars 3.69k forks source link

couldn't locate on next button and click in this website, what should I do? #33058

Closed cobaltautomationdev closed 1 month ago

cobaltautomationdev commented 1 month ago

Please do not submit this issue.

cobaltautomationdev commented 1 month ago

https://commerce.spscommerce.com/fulfillment/transactions/list/ , can any guys try to use playwright to locate next button after input email address.

async def run(playwright: Playwright) -> None:
      browser = await playwright.chromium.launch(headless=False)
      context = await browser.new_context()
      page = await context.new_page()
      await page.goto("https://commerce.spscommerce.com/fulfillment/transactions/list/")

      await page.get_by_label("Email Address").fill("xxxx@test.com")
      await page.get_by_label("Remember Me").check()
      await page.get_by_role("button", name="Next").click() 
johnnygerard commented 1 month ago

Playwright has features to help locate elements on the page (see Generating locators).

yonglee7015 commented 1 month ago

Playwright has features to help locate elements on the page (see Generating locators).

Thank you for your response. I understand that the method should help me locate elements, as in my code: await page.get_by_role("button", name="Next").click(). However, it doesn't seem to work. You can try reproducing the issue with this code.

johnnygerard commented 1 month ago

It's hard to help you without knowing what your issue is.

Do you have an error message?

johnnygerard commented 1 month ago

I just realized that you used the "Questions and Help 💬" template to submit an issue. You are not supposed to do that. Also, using multiple accounts is also not ideal for communication.

Good luck!

yonglee7015 commented 1 month ago

Apologies, I forgot to switch accounts. I'm reaching out for assistance with an issue I'm encountering: despite using the provided code, I'm unable to click the 'Next' button. I would greatly appreciate any help with this matter. The code is provided by code gen.When run,it does not work as expected.You can test with the website,you will get my point.

pavelfeldman commented 1 month ago

Does not look like a bug report or a feature request, closing

cobaltautomationdev commented 1 month ago

Please don't close this just yet. You can try entering a dummy email address and then click the 'Next' button. The key is to ensure that you're able to proceed by clicking 'Next.' If you encounter any issues, it might be a bug with Playwright. Let's verify this step to confirm. Have you tried it already? Please don't overlook this important point.

cobaltautomationdev commented 1 month ago

add await page.wait_for_load_state() before next button solve this issue