PDA

View Full Version : Sencha Test 2.0.0.359 - WebDriver Errors in Multi-Page Application



jjdoyle
27 Feb 2017, 9:44 AM
I have an existing multi-page application that uses ExtJS 6.2 as a frontend that I want to test using Sencha Test. I have set up a WebDriver Scenario with all Globals allowed, and the Base URL being the main URL of my application. I'm using the ST API to log in to the application and navigate across a few pages to get to the one I want to test. However, about half the time after I've logged in and I'm redirected to the main page of the app as a logged in user, my test fails with the following error:

Failed with error "no such element: Unable to locate element: {"method":"css selector","selector":"[data-senchatestid='1488203138419']"}"

Another error I see a lot is:
org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document

This one appears in the Log tab of the Test Runner. Both seem like something is going wrong with the Test Runner. I've had some luck getting my tests to run, but more often than not, I'm hit with these weird errors.

craigcomstock
28 Feb 2017, 7:03 AM
Can you include more of your test code? Are you possibly re-using future instances after page navigation? That might cause this issue.

jjdoyle
28 Feb 2017, 7:52 AM
Here is an example of me trying to Login and navigate down a couple of pages. It seems to fail on the ST.component('shortcutlistview') line - at least, that's where it failed when I broke this up into multiple it() functions.


describe("Open Viewer.js", function() { it("should pass", function() {
//Find the username field, enter mvtest, and push enter.
//Will navigate to shortcutlist page
ST.field('textfield[itemId="username"]').type('mvtest').type({key: "Enter", caret: 3, timeout: 1000}).wait(1500).and(function() {
//Find the shortcut group named "Preparation", and the link within it named "Preparation"
//Click that link and it will navigate to search results.
ST.component('shortcutlistview shortcutgroup[groupName="Preparation"]', 5000)
.down('//li/a[contains(., "Preparation")]').click().wait(1500).and(function() {
//Find the search results grid and click on the first row.
ST.grid('searchresultgrid', 5000).rowAt(0).click()
});
});
});
});