select command incompatible between IDE and selenium-side-runner

Open Beginner friendly
#1,853 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
typescript
Domain
testing

Research direction

The index locator is in packages/side-runtime/src/webdriver.ts around line 2096, where index builds a *:nth-child(${index}) CSS selector. Compare that with how Selenium IDE counts the index for the same select command, using the attached .side project as the reproduction. Done means that index=6 selects the same option in side-runner that IDE selects, with a test covering the select command.

Written by the indexing model from the issue text.

Description

🐛 Bug Report

If select command has a value of index, the result is incompatible with selenium-side-runner. In Selenium IDE, the index of 6 is the seventh child. However in selenium-side-runner, it is the sixth child.

{
      "id": "c26f2fcb-37ee-463a-a891-16ec2c80d8d1",
      "comment": "",
      "command": "select",
      "target": "id=month",
      "targets": [],
      "value": "index=6"
    }

https://github.com/SeleniumHQ/selenium-ide/blob/trunk/packages/side-runtime/src/webdriver.ts#L2096

index: (index: string) => By.css(`*:nth-child(${index})`),

To Reproduce

Steps to reproduce the behavior:
I provided a script below

Expected behavior

A clear and concise description of what you expected to happen.
Selenium IDE and selenium-side-runner are compatible.

Project file reproducing this issue (highly encouraged)

Please provide a project file .side that reproduces this issue.

{
  "id": "cd6cb310-1c43-41a8-98a8-d77f5673ff79",
  "version": "2.0",
  "name": "customer-mockup",
  "url": "https://www.timeanddate.com",
  "tests": [{
    "id": "765c8d65-8988-4e06-874d-ef0c255bd682",
    "name": "click-assert",
    "commands": [{
      "id": "d83c2f01-53e0-40eb-8e75-a4419f19f0d1",
      "comment": "",
      "command": "open",
      "target": "/",
      "targets": [],
      "value": ""
    }, {
      "id": "8795b840-4de3-45e2-a091-72257f1d5bba",
      "comment": "",
      "command": "click",
      "target": "xpath=//label[contains(., 'Month')]",
      "targets": [],
      "value": ""
    }, {
      "id": "c26f2fcb-37ee-463a-a891-16ec2c80d8d1",
      "comment": "",
      "command": "select",
      "target": "id=month",
      "targets": [],
      "value": "index=6"
    }, {
      "id": "c531ef1d-d623-492d-8c1a-3ea0e8df8aa4",
      "comment": "",
      "command": "click",
      "target": "xpath=//input[@value='View Calendar']",
      "targets": [],
      "value": ""
    }, {
      "id": "e14a5acc-c16a-4119-9976-fcf13296d60e",
      "comment": "",
      "command": "waitForElementPresent",
      "target": "xpath=//h1[contains(., 'Calendar for June 2024 (United States)')]",
      "targets": [],
      "value": "10000"
    }]
  }],
  "suites": [{
    "id": "9e968b64-54fe-43a1-8356-546ba21b2b92",
    "name": "Default Suite",
    "persistSession": false,
    "parallel": false,
    "timeout": 300,
    "tests": ["765c8d65-8988-4e06-874d-ef0c255bd682"]
  }],
  "urls": ["https://www.timeanddate.com/"],
  "plugins": []
}

Issues without a reproduction project are likely to stall.

Environment

OS: Linux
Selenium IDE Version: 3.17.4
Selenium SIDE Runner Version: 4.0.12
Node version: v18.19.1

Browser:
Browser Version: Firefox 128.0.3

Dominant language
TypeScript
Stars
3.1k
Forks
823
Avg merge
3h 1m
Merged PRs (30d)
117

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SeleniumHQ/selenium-ide

All issues in SeleniumHQ/selenium-ide

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.