I have tried below code
describe('Gmail Messages', () => {
it('should read the subject lines of the messages', () => {
cy.visit('https://mail.google.com%27/)
// Assuming the email input field has an ID of 'identifierId'
cy.get('input[type="email"]').type('your-email@gmail.com')
// Assuming the 'Next' button has an ID of 'identifierNext'
cy.get('#identifierNext').click()
// Assuming the password input field has an ID of 'password'
cy.get('input[type="password"]').type('your-password')
// Assuming the 'Next' button has an ID of 'passwordNext'
cy.get('#passwordNext').click()
// Wait for the list of messages to load
cy.get('.UI tr.zA').should('be.visible')
// Extract the subject lines of the messages
cy.get('.UI tr.zA .bog span.bqe')
.invoke('text')
.then(subjects => {
// Perform assertions or further actions with the subject lines
console.log(subjects)
})
})
})