selenium-ide
selenium-ide copied to clipboard
"wait for element not present" fails in selenium-side-runner if element is not present
🐛 Bug Report
"wait for element not present" in selenium-side-runner attempts to find an element and then wait for its staleness. If an element can't be found (because it is already not present) then findElement fails:
NoSuchElementError: no such element: Unable to locate element: {"method":"li
nk text","selector":"Test"}
(Session info: chrome=70.0.3538.110)
(Driver info: chromedriver=2.44.609538 (b655c5a60b0b544917107a59d4153d4bf7
8e1b90),platform=Windows NT 6.1.7601 SP1 x86_64)
3 | await driver.get((new URL("/", BASE_URL)).href);
4 | await driver.manage().window().setSize(...(`1059x752`.split("x").map
((s) => parseInt(s))));
> 5 | await driver.wait(until.stalenessOf(await driver.findElement(By.link
Text(`Test`))), 3000);
| ^
6 | }
7 | module.exports = tests;
at Object.checkLegacyResponse (../../AppData/Roaming/npm/node_modules/sele
nium-side-runner/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (../../AppData/Roaming/npm/node_modules/selenium-side
-runner/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (../../AppData/Roaming/npm/node_modules/selenium-s
ide-runner/node_modules/selenium-webdriver/lib/http.js:441:30)
From: Task: WebDriver.findElement(By(link text, Test))
at Driver.schedule (../../AppData/Roaming/npm/node_modules/selenium-side-r
unner/node_modules/selenium-webdriver/lib/webdriver.js:807:17)
at Driver.findElement (../../AppData/Roaming/npm/node_modules/selenium-sid
e-runner/node_modules/selenium-webdriver/lib/webdriver.js:1014:17)
at Object.findElement [as test] (commons.js:5:52)
Expected behavior
"wait for element not present" should successfully finish without any waits if an element is not present.
Project file reproducing this issue (highly encouraged)
Environment
OS: Windows 7 Selenium IDE Version: 3.4.4 Selenium SIDE Runner Version: 3.4.2 Node version: v10.14.1 Browser: Chrome Browser Version: 70
same error with commands verify element not present
and assert element not present
This also impact command verify element not present. In Selenium-IDE when the above is called and element is found it just logs an error and allow test to complete (which is expected and desired), but if the same test is executed under selenium-side-runner such calls are transalted to this code and breaks the further execution of the test:
Default Suite
V Basic logon test (12540ms)
× Advanced test (23576ms)
? Default Suite > Advanced test
Assertion failed: unexpected element was found in page
108 | console.log(`[ERROR] ORA- errors on page`);
109 | }
> 110 | await expect(driver.findElements(By.xpath(`//td//span[contains(.,\'CRS-\')]`))).resolves.not.toBePresent();
| ^
111 | await driver.findElements(By.xpath(`//td//span[contains(.,\'CRS-\')]`)).then(elements => {
112 | return vars["cnt_error"] = elements.length;
113 | });
at Object.toBePresent (C:/Users/user/AppData/Roaming/npm/node_modules/selenium-side-runner/node_modules/expect/build/index.js:202:20)
at Object.<anonymous>.tests.Advanced test (commons.js:110:98)
at Object.<anonymous> (DefaultSuite.test.js:15:5)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 passed, 2 total
Snapshots: 0 total
Time: 59.001s
Ran all test suites.
+1 This is critical functionality that while broken makes this tool unable to be used in a CI environment.
Closing, tested in v4 and works as expected in ide and side-runner.
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.