///\<reference types = "cypress"/\>
///\<reference types = "cypress-xpath"/\>
describe("Interacting with dropdowns", function () {
it("Auto Suggest Dynamic Dropdown: We need to write function", function () {
cy.visit("https://www.google.com/");
cy.wait(2000);
cy.get(".gLFyf").type("Automation Testing");
cy.wait(5000);
cy.get(".wM6W7d>span").should("have.length", "12");
cy.get(".wM6W7d>span").each(($el, index, $list), function () {
if ($el.text() == "automation testing tutorial") {
cy.wrap($el).click();
}
});
cy.get(".gLFyf").should("have.value", "Automation Testing");
});
});
While execution I am getting referenceerror.Unable to execute the code in cypress and also getting the "ReferenceError" i.e., $el is not defined .