Skip to content

Simple selectbox isn't working #57

@bernhardh

Description

@bernhardh

Cypress Chrome Recorder doesn't work with simple selectboxes. Instead of using the select method, it uses the type method.

image

I have made just a very simple testpage, with an selectbox in it:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>HTML 5 Boilerplate</title>
  </head>
  <body>

        <select id="select">
                <option></option>
                <option>Option 1</option>
                <option>Option 2</option>
                <option>Option 3</option>
                <option>Option 4</option>
        </select>
  </body>
</html>

Then I created a recording where i selected some options and exported it to cypress:

describe("Selectbox", () => {
  it("tests Selectbox", () => {
    cy.viewport(1151, 1329);
    cy.visit("https://webcaravel.at/select.html");
    cy.get("#select").type("Option 1");
    cy.get("html").click();
    cy.get("#select").type("Option 3");
  });
});

When I run this test, the selectbox doesn't change the option at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions