Find Multiple Elements | Playwright - Part 12

Поделиться
HTML-код
  • Опубликовано: 1 окт 2024

Комментарии • 64

  • @ffgaming-fe3cx
    @ffgaming-fe3cx 7 месяцев назад +1

    how to find multiple elements using python? which locator or selector should i neeed?

    • @letcode
      @letcode  7 месяцев назад

      Locator function is recommended.

  • @abhishekbhardwaj7764
    @abhishekbhardwaj7764 6 месяцев назад +1

    Bro, even with latest playwright versions, let us assume I am fetching multiple elements using a locator. Then I am using all() method to take it as an array. Thn for iteration which one is advisable " for-await-of or for-of (without await) ?????

    • @letcode
      @letcode  6 месяцев назад +1

      Always with await if there is a promise involved.

    • @abhishekbhardwaj7764
      @abhishekbhardwaj7764 6 месяцев назад

      @@letcode thanks bro

  • @jeyaprakash5415
    @jeyaprakash5415 11 месяцев назад +1

    bro... repos print aaguthu
    adhukku assertion epdi???

    • @letcode
      @letcode  11 месяцев назад

      Expect use pannanum bro.
      Like getting the count and check.

  • @mudaseer21
    @mudaseer21 2 года назад +2

    Hi how to get tooltip text in playwright

    • @letcode
      @letcode  2 года назад

      You have to inspect the tooltip and text content function to get the text.

    • @mudaseer21
      @mudaseer21 2 года назад +1

      @@letcode thanks

  • @nomanshahid1397
    @nomanshahid1397 2 года назад +1

    Hi how to put if condition in playwright run two parallel workers chronium and iphone5 if i put only chronium browser page.locator then he pass chronium test cases and iphone workers test fail.
    give me suggestion

    • @letcode
      @letcode  2 года назад +1

      I think u are asking about this
      ruclips.net/video/NBHDp-QvGBQ/видео.html

  • @hemagg652
    @hemagg652 2 года назад +1

    Using Page Object Model(POM)can you please help how to search with debounce and also the radio buttons should populate when displayed

  • @danielkovacs3664
    @danielkovacs3664 2 года назад +1

    how can i click to an element?
    for examle
    if(...)
    await page.$$('').click()

    • @letcode
      @letcode  2 года назад

      $$ means finding multiple elements,
      You can do click on single element.

  • @SouravBasuRoy
    @SouravBasuRoy 3 года назад +1

    your name is bengali but accent is Tamil... whats the story here ? is it Triveni academy ?

    • @letcode
      @letcode  3 года назад

      Hahhaa.
      I'm bengali, but I live in Chennai, so more Tamil accent.

  • @iMadeThisThat
    @iMadeThisThat 3 года назад +2

    Happy to see you back and recovered, Koushik!

    • @letcode
      @letcode  3 года назад

      Thank you 😊

  • @dollygrover6045
    @dollygrover6045 3 года назад +1

    Hi Koushik - do you have any email where I can reach to you pls

    • @letcode
      @letcode  3 года назад

      koushik350@gmail.com

  • @RTCDigitalS
    @RTCDigitalS 2 года назад +1

    Amazing bro, this is the first video I watch from this playlist Will watch the rest for sure! thanks subbed!

    • @letcode
      @letcode  2 года назад

      Thank you ☺️

  • @AliKhan-wm5lt
    @AliKhan-wm5lt Год назад +1

    Hi Koushik,
    You mentioned that page.$$(locator) will not wait for all the elements to load and for that page.waitForSelector(..) has to be added. I face this issue in case of frame. But I don't find any function called waitForSelector(..) in frame. Can you suggest any solution here? All that I need is to find multiple elements that matches a locator inside a frame.

    • @letcode
      @letcode  Год назад

      Hi, don't use $ or $$, use the locator function.
      That support wait for in page and frame as well.

    • @AliKhan-wm5lt
      @AliKhan-wm5lt Год назад +1

      @@letcode Thank you so much. Will give it a try and let you know here.

    • @AliKhan-wm5lt
      @AliKhan-wm5lt Год назад

      Its working. Thank you so much bro..

  • @sunnysachdeva7373
    @sunnysachdeva7373 3 года назад +1

    in case of $$ , wont playwright wait for default timeout ?

    • @letcode
      @letcode  3 года назад

      It will wait to get the elements.

  • @shanmuktej
    @shanmuktej 2 года назад +1

    How do we add a listener?
    If we want to stop the execution of the test case if an error element is displayed on screen, what can be done?
    Only workaround I have is, after each step we should expect the element is not visible.

    • @letcode
      @letcode  2 года назад +1

      I don't think we have a listener for that,
      Using the global configuration we can read after each step but that will be applicable for all the tests, that might not be a better approach

    • @shanmuktej
      @shanmuktej 2 года назад +1

      @@letcode if we must/ need to check the element visibility after each and every step due to the requirements in a project, how to configure it globally?
      Is there any video regarding that? If not, can you make a video on it?

    • @letcode
      @letcode  2 года назад +1

      You can refer this video
      ruclips.net/video/t-KsH5p60sk/видео.html
      I used it for reporting,

  • @mdileep5135
    @mdileep5135 2 года назад +1

    Hi Koushik,
    I am trying to execute the typescript test as
    test("Verify login", async () => {
    try{
    page.type('loginInput', userName);
    //some code
    }
    catch(error){
    console.log('print error here', error);
    }
    }
    test.afterAll(async () => {
    console.log("Teardown Phase.....");
    }
    Here, If I am facing any locator issue it just comes out of tests and executing test.afterall() and then going back to catch block in test()
    Is there any way to handle the locator exceptions (if it's unavailable due to page load/some wrong locator), I want to print the exact error / exception

    • @letcode
      @letcode  2 года назад

      Hi,
      If you use the await properly, then try catch should work fine.

    • @mdileep5135
      @mdileep5135 2 года назад +1

      doing same, but still the same issue, and its an intermittent issue only

    • @letcode
      @letcode  2 года назад +1

      Ok, I will look into this

    • @mdileep5135
      @mdileep5135 2 года назад

      @@letcode Also please help me that how can we handle the "TypeError: Cannot read property 'close' of undefined" in playwright

  • @maheshshet9564
    @maheshshet9564 2 года назад +1

    Nice Videos and lot of efforts here. Just needed some pointers on hover and reading hover text. Could not find anything relevant.

    • @letcode
      @letcode  2 года назад

      Thanks 👍.
      Hover function is there, that should do that.

    • @maheshshet9564
      @maheshshet9564 2 года назад +1

      @@letcode yeah, tried it, but unable to read the hovertext. BTW hover text has no locators.
      Thanks.

    • @letcode
      @letcode  2 года назад

      There is some default tooltip in angular and react, we cannot find proper locators for that.
      They are from html 5 native error message.

  • @ghummakad_premi
    @ghummakad_premi 3 года назад +1

    How can I click on a selective url - for e.g - if there are multiple elements inside the repos array, and I want to click on the first link of that - how to do that?

    • @letcode
      @letcode  3 года назад

      From the repos you can again find an element, like we used to do on web table concept.

    • @ghummakad_premi
      @ghummakad_premi 3 года назад +1

      @@letcode do I have to have an kind of loop or filter for that … because of I do repos[0].click(), nothing is clicked and the operation times out

    • @letcode
      @letcode  3 года назад

      If u using my code... Then u have to find a tag. I have taken only the li tag, so clicking on that will perform nothing.

  • @danidear
    @danidear Год назад +1

    Thanks! I'm a new sub.

    • @letcode
      @letcode  Год назад

      Welcome to the channel 😌

  • @yotuber09
    @yotuber09 2 года назад +1

    Are they any situations where GUI objects cannot be recognized using Playwright , both browser and windows based screens , can u please enlist here

    • @letcode
      @letcode  2 года назад +1

      No limitations with playwright.
      R u facing any issue?

    • @yotuber09
      @yotuber09 2 года назад +1

      But is there any object on GUI that playwright cant recognize..

    • @letcode
      @letcode  2 года назад

      GUI means if u r asking about native windows application, then that is not possible.
      Only within browser it can interact.

    • @yotuber09
      @yotuber09 2 года назад +1

      @@letcode ok but browser all buttons images will work right

    • @letcode
      @letcode  2 года назад

      @@yotuber09 yes

  • @danielstoicamusic
    @danielstoicamusic 2 года назад +1

    How do you find multiple elements by using the page.locator function?

    • @letcode
      @letcode  2 года назад

      Same function can be used to find elements.
      playwright.dev/docs/locators

    • @danielstoicamusic
      @danielstoicamusic 2 года назад +1

      @@letcode nope. Locators are strict. This means that all operations on locators that imply some target DOM element will throw an exception if more than one element matches given selector.

    • @letcode
      @letcode  2 года назад

      Nope u r wrong my friend,
      It's strict if u r trying to access 1 element, if it has multiple find then u can use the nth element.

    • @letcode
      @letcode  2 года назад +1

      I think i have already explained it, kindly watch this video.
      ruclips.net/video/cvLaBBfuYmA/видео.html

    • @danielstoicamusic
      @danielstoicamusic 2 года назад

      @@letcode Thanks!

  • @nagulrd5214
    @nagulrd5214 3 года назад +1

    ❤️

    • @letcode
      @letcode  3 года назад

      Video paathutu heart podanum 😂

    • @nagulrd5214
      @nagulrd5214 3 года назад +1

      @@letcode not like that bro , epdium nega Soli kudutha enaku super ah purium , full ah pathutu ❤️potalum onu tha video va pakama ❤️ potalum 💯 worth tha . Cucumber or Jenkins matum konjam pathu potu vidunga bro , enaku konjam use full ah irukum