Currently, I am attempting to store the titles of an iframe header in an array and then display the array with its elements in the console. Although the elements are being added successfully, there is a problem where the console shows "Array[9]" instead of "[Home, Courses, ...]". Is there a way to display the elements rather than the object? Below is the code snippet:
it("Get the elements from the header of the iframe and add them to an array", () => {
cy.visit("https://www.rahulshettyacademy.com/AutomationPractice/")
let headerArray = []
cy.frameLoaded("#courses-iframe")
cy.iframe("#courses-iframe").find(".nav-outer > .main-menu > .navbar-collapse > ul > li").each(($row, index, $rows) => {
headerArray.push($row.text())
})
cy.log(headerArray)
})
Here is the response shown in the console: