Skip to main content

It's mentioned in the documentation mentioned in the comment section, I recommend reading it. Speficially Specifically, you can read this part about closures.

What you can do is to put the other cy.get() inside the first one:

cy
  .get('...')
  .then($today => {
    
    cy
      .get('...')
      .then($tomorrow => {
        // you have access to both $today and $tomorrow
    });
});
cy
  .get('...')
  .then($today => {
    
    cy
      .get('...')
      .then($tomorrow => {
        // you have access to both $today and $tomorrow
    });
});

I shortened the code (e.g. didn't use the long selectors) in order to focus on the main point.

It's mentioned in the documentation mentioned in the comment section, I recommend reading it. Speficially, you can read this part about closures.

What you can do is to put the other cy.get() inside the first one:

cy
  .get('...')
  .then($today => {
    
    cy
      .get('...')
      .then($tomorrow => {
        // you have access to both $today and $tomorrow
    });
});

I shortened the code (e.g. didn't use the long selectors) in order to focus on the main point.

It's mentioned in the documentation mentioned in the comment section, I recommend reading it. Specifically, you can read this part about closures.

What you can do is to put the other cy.get() inside the first one:

cy
  .get('...')
  .then($today => {
    
    cy
      .get('...')
      .then($tomorrow => {
        // you have access to both $today and $tomorrow
    });
});

I shortened the code (e.g. didn't use the long selectors) in order to focus on the main point.

added 3 characters in body
Source Link
pavelsaman
  • 4.5k
  • 1
  • 14
  • 37

It's mentioned in the documentation mentioned in the comment section, I recommend reading it. Speficially, you can read this part about closures.

What you can do is to put the other cy.get() inside the first one:

cy
  .get('...')
  .then($today => {
    
    cy
      .get('...')
      .then($tomorrow => {
        // you have access to both $today and $tomorrow
    });
});

I shortened the code (e.g. didn't use the long selectors) in order to focus on the main point.

It's mentioned in the documentation mentioned in the comment section, I recommend reading it. Speficially, you can read this part about closures.

What you can do is put the other cy.get() inside the first one:

cy
  .get('...')
  .then($today => {
    
    cy
      .get('...')
      .then($tomorrow => {
        // you have access to both $today and $tomorrow
    });
});

I shortened the code (e.g. didn't use the long selectors) in order to focus on the main point.

It's mentioned in the documentation mentioned in the comment section, I recommend reading it. Speficially, you can read this part about closures.

What you can do is to put the other cy.get() inside the first one:

cy
  .get('...')
  .then($today => {
    
    cy
      .get('...')
      .then($tomorrow => {
        // you have access to both $today and $tomorrow
    });
});

I shortened the code (e.g. didn't use the long selectors) in order to focus on the main point.

Source Link
pavelsaman
  • 4.5k
  • 1
  • 14
  • 37

It's mentioned in the documentation mentioned in the comment section, I recommend reading it. Speficially, you can read this part about closures.

What you can do is put the other cy.get() inside the first one:

cy
  .get('...')
  .then($today => {
    
    cy
      .get('...')
      .then($tomorrow => {
        // you have access to both $today and $tomorrow
    });
});

I shortened the code (e.g. didn't use the long selectors) in order to focus on the main point.