Comments (12)
Also, does your app have nodeIntegration
enabled in both windows?
from spectron.
BTW windowHandles is missing in the readme.
The app.client
API is currently documented at http://webdriver.io/api.html
from spectron.
console.log(await app.client.browserWindow.getTitle());
This should be this instead:
console.log(await app.browserWindow.getTitle());
from spectron.
unknown error: window[requireName] is not a function
Do you have more of the stack trace that raised this error?
from spectron.
Also, does app.client.getTitle()
work for you?
from spectron.
Thank you very much for your time.
unknown error: window[requireName] is not a function
unfortunately this did not appeared with a stack trace (I am using ava).
Thanks to your hints I made it work. The problem was nodeIntegration
being disabled indeed. So it seems that this error was actually triggered by windowByIndex
.
I changed app.client.browserWindow.getTitle()
to app.browserWindow.getTitle()
and it works. app.client.getTitle()
works also.
So after all maybe adding a note in readme about nodeIntegration
would be helpful.
I have one more question if I may - can I talk to the main process ipc directly from tests? I am trying to trigger some things directly from the tests instead of the renderer process.
I have tried const ipc = app.electron.ipcRenderer;
but ipc.send
does not seem to send to the main process. Is there any way to do that or do I just have to setup another ipc connection myself?
from spectron.
So after all maybe adding a note in readme about nodeIntegration would be helpful.
Good point, I added https://github.com/electron/spectron#node-integration today which hopefully makes thing clearer.
can I talk to the main process ipc directly from tests?
It should work, I just uploaded a simple spec to test it and it appears to pass currently, 6d36884
from spectron.
Hmm app.electron.ipcRenderer.send('ipc-event', 'test')
does not work for me. Not sure what is the reason.
from spectron.
Oh wait, got it. Seems that when you use ipcRenderer
also in html that is loaded in your app it takes precedence and using it directly in tests fails then. So it seems that it will only work if you somehow disable ipc
in the renderer for test purposes.
from spectron.
Seems that when you use ipcRenderer also in html that is loaded in your app it takes precedence and using it directly in tests fails then. So it seems that it will only work if you somehow disable ipc in the renderer for test purposes.
Hmm, that is surprising, could you include the code to help me reproduce this locally?
from spectron.
Good that you have asked.
I've forked spectron and changed the fixtures/app
just to find out that it works. Now I've reverted my changes from yesterday and it also works 😄
So it seems that I had some other problem somewhere which I probably fixed with other changes. It started working when I removed var ipc = require('electron').ipcRenderer;
from my index.html
but it seems that this was only coincidence.
Tried to nail it but my IDE did not keep so detailed track of local changes.
So anyway, thank you for your time once again!
from spectron.
[quote]Also, does your app have nodeIntegration enabled in both windows?[/quote]
How can I check about that? Where is this setting defined?
from spectron.
Related Issues (20)
- Working docker image to run electron test headless HOT 10
- Element Wasn't Found After Upgrading my Spectron Version to 15 & Electron to 13 HOT 1
- Please release Spectron 16, compatible with electron 14 HOT 8
- api http mocking
- Module name "process" has not been loaded yet for context:
- This version of ChromeDriver only supports Chrome version 91 HOT 1
- failing to successfully launch Spectron headless in Docker on Jenkins
- Spectron test table contents
- export interface SpectronClient extends WebdriverIO.BrowserObject HOT 1
- test suddenly failing on Github Action Windows
- Support Electron 15
- is it possible to work with selenium grid using the image
- ChromeDriver / Chrome version mismatch HOT 2
- app.stop() not work, electron process stay in the background after the mocha test program exits HOT 2
- Rewrite Discussion HOT 12
- Spectron: Deprecation Announcement HOT 10
- This version of ChromeDriver only supports Chrome version HOT 1
- TypeError: waitUntilWindowLoaded Cannot read property 'isLoading' of undefined HOT 5
- --
- unknown error: call function result missing int 'status' HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spectron.