Working with Multiple Elements in Cypress | .each() | Cypress Testing

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ม.ค. 2025

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

  • @sdetunicorns
    @sdetunicorns  ปีที่แล้ว

    Cypress Playlist - th-cam.com/play/PL6AdzyjjD5HAr_Jq1hwpFUIO49uyBZ9ma.html
    Check out all the Courses - bit.ly/3SBTtKb
    Join Mailing List - bit.ly/3Nc9Ewx
    If you like this video, make sure to subscribe to the channel and share this video :)

  • @semihcetin5122
    @semihcetin5122 2 ปีที่แล้ว +2

    Hi how can ı click to one of them ? randomly

  • @S4NTIS0
    @S4NTIS0 ปีที่แล้ว

    great content and to the point!

  • @VinodPatelC
    @VinodPatelC ปีที่แล้ว

    Hi, your video is very useful. it is working for menu item list, but i have the drop down with select , option tag. so need to change anything in above code.

  • @marchbaby2431
    @marchbaby2431 2 ปีที่แล้ว

    how to iterate through multiple 'select' list having option..thanks

  • @ShrmaShiva
    @ShrmaShiva 3 ปีที่แล้ว

    What is the use of $(item) at 7:46??

    • @sdetunicorns
      @sdetunicorns  3 ปีที่แล้ว

      $(item) is returning each individual elements from a set of multiple list and then i am doing a .text on it to get the text value

  • @krumkostov9710
    @krumkostov9710 ปีที่แล้ว

    Hi, Which visual studio extensions do you use for writing Cypress tests?

    • @sdetunicorns
      @sdetunicorns  ปีที่แล้ว

      ES6 snippets lets me generate describe and it blocks quickly

  • @RahiyanSafinOfficial
    @RahiyanSafinOfficial 2 ปีที่แล้ว

    hey! your videos are too much helpful, but could you kindly help how to click on every items of the link and go to the expected urls?

  • @avas9406
    @avas9406 ปีที่แล้ว

    Hello , I have a problem , what if I want to compare , between two elements from the list , for example if the list contains dates, and I want to see if each date is greater than the next one ? Thank you ! @sdetunicorns

  • @cwp888
    @cwp888 2 ปีที่แล้ว

    Hi how can I choose one to click on?

    • @sdetunicorns
      @sdetunicorns  2 ปีที่แล้ว

      within .each function, you can select which element you need to click on

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

    hi!! it's a great this help to me, can you help me ?
    why in this code not working the reverse function
    it('Invoke',()=>{
    const reverse =(s) =>Cypress._.reverse(s);
    const double =(n) => n*n;
    const myArray = ['1', '2', '3'];
    cy.wrap([reverse,double]).invoke(0,myArray).then((element) =>{console.log(element)}) //Yielded ['1','2','3'] must be ['3','2','1']
    })

  • @humanhealth8303
    @humanhealth8303 3 ปีที่แล้ว

    amazing channel.

  • @samundradhakal2363
    @samundradhakal2363 3 ปีที่แล้ว

    When i tried the same, it just runs once when I have 5 items in the array. Do you know why?

    • @sdetunicorns
      @sdetunicorns  3 ปีที่แล้ว

      Try comparing your code with this file to make sure you didn't make any mistakes -
      github.com/automationbro/cypress-tests/blob/master/cypress/integration/specs/home.spec.js

  • @UdayKiran-bw9nh
    @UdayKiran-bw9nh 2 ปีที่แล้ว

    How to get size of a list and save it in var ( like in selenium) .
    int count = driver.findelements(by.xpath(...)).size();

    • @sdetunicorns
      @sdetunicorns  2 ปีที่แล้ว

      You can do this - const elLen = Cypress.$(el).length;

    • @UdayKiran-bw9nh
      @UdayKiran-bw9nh 2 ปีที่แล้ว

      @@sdetunicorns Thanks bro. It worked 🙂

  • @itshamiiid
    @itshamiiid 2 ปีที่แล้ว +1

    thanks

    • @sdetunicorns
      @sdetunicorns  ปีที่แล้ว

      Glad you enjoyed the content. We have created multiple courses that takes our students from ground level. If you want to become a full stack Automation engineer, Please check out the academy at: sdetunicorns.com/courses/

  • @farazmazhar7656
    @farazmazhar7656 3 ปีที่แล้ว

    what is you don't know the length of the list the list is dynamic, everytime it is called on a different page different lists are coming how can we iterate through that? can you please make a video with unknown number of fields

    • @sdetunicorns
      @sdetunicorns  3 ปีที่แล้ว

      the iteration would still be the same as we don't care how long the list is, you can still do .each on it and do anything the items you get back from the list.

  • @spidyniks
    @spidyniks ปีที่แล้ว