Code
I want to put found text in a list then .log() it
I copied the .replace() method from my previous code but I only know how to make it put a space after 5 letters. Is there a way to make it separate each "word" from a different div’s? My log looks like this log and I want it to look like:
isSystemObject name description avatar tags isSystemObject name description avatar tags
Appreciate all the help
>Solution :
You can use the each() method to loop over all elements, extract the text and then apply the replace() method like this:
cy.get('#header').find('#label').each(($ele) => {
const nazwy = $ele.text().trim().replace(/(.{5})/g,"$1 ")
cy.log(nazwy)//prints label texts one by one
})