How to narrow and chain your Playwright locators

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 พ.ย. 2024

ความคิดเห็น •

  • @glebmirosnikovs6722
    @glebmirosnikovs6722 หลายเดือนก่อน

    Thank you, great tip. Now I know, how to combine playwright locators. Great stuff!

    • @ChecklyHQ
      @ChecklyHQ  หลายเดือนก่อน

      Glad it was helpful! 🦝

  • @mncrff6687
    @mncrff6687 5 หลายเดือนก่อน +1

    This video is helpful to understand how narrowing works, so thank you for that! However, as an accessibility engineer there is one problem with the example you have used. It can be difficult for users to identify which "Remove" button is associated with which user or racoon in this case. It would be better to continue to use only the getByRole locator and add unique accessible names to each button, so when I'm navigating with a screen reader I know exactly which user's "remove" action I'm on. One way to do this without changing the visible text and/or visual design would be to add an aria-label to each button. The aria-label should contain the visible text but add more description. Ex. aria-label="Remove Ricky Racoon". With this unique accessible name you can then continue to use getByRole and know your interactive elements are uniquely named for screen reader users. Ex. getByRole('button', { name: 'Remove Ricky Racoon' })

    • @ChecklyHQ
      @ChecklyHQ  4 หลายเดือนก่อน

      Thank you for your detailed explanation and you're absolutely right. 💙 Great call! I didn't think of `aria-label` when looking for a narrowing example. I might record a follow up covering accessible names.

  • @The4m3r
    @The4m3r 6 หลายเดือนก่อน

    Useful as always thank you Stefan !

  • @roblesrt
    @roblesrt 6 หลายเดือนก่อน

    Thank you...very helpful! Just shared on Twitter!

    • @ChecklyHQ
      @ChecklyHQ  6 หลายเดือนก่อน

      Awesome, thank you!

  • @_unreal_engineer
    @_unreal_engineer หลายเดือนก่อน +1

    What is your IDE theme name?

    • @ChecklyHQ
      @ChecklyHQ  หลายเดือนก่อน

      I use "Yi Dark". :)

  • @1485935
    @1485935 6 หลายเดือนก่อน

    Hello, I'm currently working on a project as new joiner, is there a way to use the next available port in a localhost using playwright, I'm using 5000 for example, and If this one is running I would like my test uses the next available, hope you can help me with this.

    • @ChecklyHQ
      @ChecklyHQ  4 หลายเดือนก่อน

      I'm not quite sure I understand, but you should be able to configure your local webserver in the Playwright config. playwright.dev/docs/test-webserver#configuring-a-web-server Does this help?

  • @HossamEldinMohamed3
    @HossamEldinMohamed3 6 หลายเดือนก่อน

    Love your videos 🤩 Keep it up

    • @ChecklyHQ
      @ChecklyHQ  6 หลายเดือนก่อน

      Thanks! 💙 Happy you like them!