Hola chicos, intento web scraping con Cypress. Quiero tomar una carta de un sitio web y volver a escribirla en el mismo sitio web, pero recibo un error.
Recibo este error:[1]: https://i.stack.imgur.com/5LDMG.png
Este es mi código:
const { cwd } = require("process"); require("cypress-xpath"); // script.js created with Cypress // // Start writing your Cypress tests below! // If you're unfamiliar with how Cypress works, // check out the link below and learn how to write your first test: // https://on.cypress.io/writing-first-test //submit '//*[@id="login-form"]/div[3]/input' //password '//*[@id="LoginForm_pw"]' //username '//*[@id="LoginForm_username"]' describe("My First Test", () => { it("Visits the Kitchen Sink", () => { function sleep(ms) { return new Promise((resolve) => setTimeout(resolve, ms)); } var newWebsite = "https://at4.typewriter.at/index.php?r=typewriter/runLevel" cy.visit("https://at4.typewriter.at/"); //__________________________________\\ //____________________________________\\ cy.get("#LoginForm_username").type("dasda"); cy.get("#LoginForm_pw").type("asdasd"); cy.xpath('//*[@id="login-form"]/div[3]/input').click(); cy.wait(3000); cy.visit(newWebsite); function loop() { let actualLetter = cy.xpath('//*[@id="actualLetter"]').text; if (actualLetter!=undefined){ cy.xpath('//*[@id="textInput"]').type(actualLetter); } setInterval(loop, 1000); } loop(); }); });