When calling waitUntilWindowLoaded, webContents is not set in Application
See original GitHub issueI’m seeing: waitUntilWindowLoaded: Cannot read property ‘isLoading’ of undefined
This is the same issue as reported in issue 157, but that was closed, so I thought I would open a new issue. See: https://github.com/electron/spectron/issues/157
I am using spectron 3.4.0 with electron 1.3.2, but I also tried spectron 3.3.0 and this made no difference for me.
After running a lot of tests and debugging, I am pretty convinced the issue is related to the following:
It appears that things work fine as long as the electron App under test creates AND loads its window immediately upon call to the app ready event handler. However, if loading the window is deferred to perform some other processing first, the above error occurs consistently.
Just to be real clear here:
The following does not seem to have a problem:
let mainWindow app.on('ready', () => { mainWindow = new BrowserWindow({ width: 1400, height: 900, backgroundColor: '#EAECEE' }) mainWindow.loadURL(`file://${__dirname}/index.html`) })
However, the following always seems to fail:
let mainWindow app.on('ready', () => { mainWindow = new BrowserWindow({ width: 1400, height: 900, backgroundColor: '#EAECEE' }) setTimeout(() => { mainWindow.loadURL(`file://${__dirname}/index.html`) }, 2000) })
Issue Analytics
- State:
- Created 6 years ago
- Reactions:9
- Comments:26 (1 by maintainers)
Top GitHub Comments
Oh, I found the problem. It’s because I opened the devtool in the main script. After disabling it, it works well.
Using electron@5 you must set
This fixed my issue.