Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

side-runner fails xpath count on missing element #1585

Closed
jezahl opened this issue Jan 17, 2023 · 5 comments
Closed

side-runner fails xpath count on missing element #1585

jezahl opened this issue Jan 17, 2023 · 5 comments

Comments

@jezahl
Copy link

jezahl commented Jan 17, 2023

🐛 Bug Report

In the Chrome plugin, using Store Xpath Count on a missing element gives a count of 0.
Running the same test in the side-runner gives an error if the element is not present

To Reproduce

As above

Expected behavior

a missing element should return an xpath count of 0

Project file reproducing this issue (highly encouraged)

{
"id": "3e3ee9d3-f3fa-4773-a518-726a2aa6b10a",
"version": "2.0",
"name": "xpath",
"url": "https://www.google.com",
"tests": [{
"id": "12ebf89b-3d93-496a-898b-3b7708d1f717",
"name": "Xpath",
"commands": [{
"id": "fdae012c-9c2f-4077-b222-1a1286a35c28",
"comment": "",
"command": "open",
"target": "/",
"targets": [],
"value": ""
}, {
"id": "1477cfb7-dc87-4aad-8bcc-ba86a0134285",
"comment": "",
"command": "storeXpathCount",
"target": "xpath=//*[@id="some-element"]",
"targets": [],
"value": "myvar"
}, {
"id": "7887d14a-3c69-4a72-9a1a-c93cab9f8d46",
"comment": "",
"command": "echo",
"target": "${myvar}",
"targets": [],
"value": ""
}]
}],
"suites": [{
"id": "9bfa899d-388f-4775-a701-ff3e2c237558",
"name": "Default Suite",
"persistSession": false,
"parallel": false,
"timeout": 300,
"tests": ["12ebf89b-3d93-496a-898b-3b7708d1f717"]
}],
"urls": ["https://www.google.com/"],
"plugins": []
}

In Chrome:-

Running 'Xpath'
open on / OK
storeXpathCount on xpath=//*[@id="some-element"] with value myvar OK
echo: 0
'Xpath' completed successfully

In Side-runner:-

autotest@AUTOTEST ~]$ selenium-side-runner -d xpath.side
info: Running test Xpath
debug: Playing state changed prep for test Xpath
info: Building driver for chrome
info: Driver has been built for chrome
debug: Playing state changed playing for test Xpath
debug: executing open|/
debug: passed open|/
debug: executing storeXpathCount|xpath=//[@id="some-element"]|myvar
debug: errored storeXpathCount|xpath=//
[@id="some-element"]|myvar
debug: Playing state changed errored for test Xpath
info: Finished test Xpath Failure
warn: Completed with failure
FAIL .local/lib/node_modules/selenium-side-runner/dist/main.test.js
Running project xpath
Running suite Default Suite
✕ Running test Xpath (2435 ms)

● Running project xpath › Running suite Default Suite › Running test Xpath

Environment

OS: Windows/Linux
Selenium IDE Version: 3.17.2
Selenium SIDE Runner Version: 4.0.0.-alpha.37
Node version: <!-- e.g.: 16

@toddtarsi
Copy link
Contributor

Thanks for reporting this, I'll take a look next weekend. We have a test in the CI thats failing for this.

@wilbur-sun
Copy link

Any update to this? storeXpathCount fails for me in selenium-side-runner

debug: errored storeXpathCount|xpath=//div[@id='loginBody']|isLogin
error: Unknown command storeXpathCount

@toddtarsi
Copy link
Contributor

No, I still have to look at it. This weekend I'll dive in, thanks for the reminder.

@toddtarsi
Copy link
Contributor

@jezahl - Okay, I just finished looking! I repaired that test, it is a very easy fix:

  1. Open your side file JSON,
  2. Just find and replace: storeXPathCount -> storeElementCount

Voila! No locator specific count thing in the new version. That seems silly anyway tbh

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators May 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants