ExTester: Your Essential UI Testing Companion for Visual Studio Code Extensions! Seamlessly execute UI tests with Selenium WebDriver, ensuring robustness and reliability in your extension development journey. Simplify UI testing for your VS Code extensions and elevate the quality of your user interface effortlessly.
I sometimes get StaleElementReferenceError exceptions on my code, where all it does is reference the driver.
For example, this suite has an outer describe() that does this:
before(async function(){
testWorkspacePath = await generalHelpers.commonTestSuiteSetup(suiteName);
await VSBrowser.instance.openResources(testWorkspacePath);
await (await new ActivityBar().getViewControl(generalHelpers.TestConstants.VIEW_CONTAINER_TITLE))?.openView();
// now to initialize the view
const view = new SideBarView();
content = view.getContent();
});
and then there's an internal bloc that does this:
describe('Project View', () => {
let tree: CustomTreeSection;
before(async () => {
//Common.extendProductInfo.setMinimalVersion(24, 4);
tree = await content.getSection(generalHelpers.TestConstants.STRUCTURE_SECTION_TITLE);
await generalHelpers.wait(300);
await tree.expand();
let driver = POFactory.getDriver(VSBrowser.instance.driver);
await driver.wait(until.elementLocated(By.css(`div[aria-label="Screens"]`)), 5000, `Timed out on project view`, 100);
});
I sometimes get this error:
StaleElementReferenceError: stale element reference: stale element not found
(Session info: chrome=120.0.6099.291)
at Object.throwDecodedError (node_modules\selenium-webdriver\lib\error.js:521:15)
at parseHttpResponse (node_modules\selenium-webdriver\lib\http.js:510:13)
at Executor.execute (node_modules\selenium-webdriver\lib\http.js:443:28)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Driver.execute (node_modules\selenium-webdriver\lib\webdriver.js:740:17)
Is there a way to avoid this issue? Force a refresh?
Thanks!
Steps to reproduce
I don't have specific repro steps. It's a sporadic issue in my tests where the context sometimes goes stale for some reason
Logs
StaleElementReferenceError: stale element reference: stale element not found
(Session info: chrome=120.0.6099.291)
at Object.throwDecodedError (node_modules\selenium-webdriver\lib\error.js:521:15)
at parseHttpResponse (node_modules\selenium-webdriver\lib\http.js:510:13)
at Executor.execute (node_modules\selenium-webdriver\lib\http.js:443:28)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Driver.execute (node_modules\selenium-webdriver\lib\webdriver.js:740:17)
Describe the bug
I sometimes get StaleElementReferenceError exceptions on my code, where all it does is reference the driver. For example, this suite has an outer describe() that does this:
I sometimes get this error:
Is there a way to avoid this issue? Force a refresh?
Thanks!
Steps to reproduce
Logs
Operating System
Windows 10
Visual Studio Code
1.88.0
vscode-extension-tester
8.0.2
NodeJS
18.13
npm
8.19.3