-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v3 features #593
Comments
#596 makes me wonder if changing |
Maybe have Have actions with selectors wait for the selector before doing the action (#388). Capybara (Ruby), for example, does this. It could possibly be configurable (though I think you’d want opt-out rather than opt-in). |
IPC safety will likely make it into the next release of Nightmare. |
Hm, how are you planning on doing that? Using
To what end? Should
Fully on-board for an implementation of #388. |
I think just calling
I think I was thinking so you could get in as early as DOMContentLoaded or maybe before other scripts, but maybe specifying preload stuff somehow would be better. Not an idea I’d thought through deeply. |
Of course. Y'know, I've read the
I was pondering out loud, and now I'm wondering if plugging preload is a good idea. I think preload is executed prior to every page load, in so doing losing a bit of control - there are probably situations where you want to run a given script on a given page's load. I doubt I'm thinking about it the way you are: what would you suggest as API changes? It seems like you're advocating having a navigation setup method and a navigation method - am I anywhere close to being on the same page? |
I've been tinkering with the idea of changing the Electron part of .call({require: require, parent: parent}) ...to something more like.... .call({
require: (lib) => {
if(lib==='nightmare-plugin') {
return {
name: name,
options: options,
parent: parent,
win: win
};
}
return require(lib);
},
parent: parent
}) ... which would make the handler signature be I realize wrapping |
I definitely agree that function signature is not only a little ugly, but very hard to get right. I have had to look it up in the README literally every single time I’ve needed to use it and I’ve gone so far as to write it like But why not just make those variables ambiently available in the plugin’s closure instead of wrapping require? Or, barring that, have plugins take two args: an object with all the things (as you’d get from the require call in your example) and the (Also agree that dropping |
It’s probably not. I think my real desire, initially, was just to be able to run code before waiting for the whole page to fully finish loading all its resources (exactly how, in the client, you often want to run on BUT the more I think about it, that makes a lot of things more complicated: have all the page’s scripts (if some where deferred) loaded yet? What if you just want to load a page and screenshot it? Now you have to load, wait, then screenshot. Etc. A possible alternative might just be to add an option to |
Me too. And I wrote the [expletive redacted] thing. I'm going to go on a limb and say it's the most unwieldy part of Nightmare, and humbly apologize.
It's certainly easy to do, but makes where those variables came from kind of opaque. The less it seems like magic, the better. (Using
The options hash was frowned upon in the orginal incarnation. I wouldn't be totally against it (provided it has a descriptive name), but |
That's what I was guessing, and that would be awkward to cram into preload. That's why I walked it back. I'm not sold that plugging preload is a bad thing necessarily (having to redefine all of the machinery for
This is what I was thinking, but I thought maybe there was an obvious part that I had missed. (I have a penchant for overcomplication.)
I'm trying to think of countercases, and while I can think of instances where not waiting is silly, they are still valid use cases and I think would behave properly. (Eg, |
Generally: have every action return something? In a similar vein, be better about errors. Also: make all errors instances of |
Can't +1 this enough.
That's something I had not considered, but the idea is certainly appealing.
This is probably worth doing. Added #646. |
Seriously, when this release will be available? Popups / New windows are giving me serious nightmares and struggling a lot 😭 I'm still using nightmare-window-manager, but sometimes it does not help (popup logins for example, triggered by javascript with anti csrf token + link of something, etc and all of these are obfuscated or really painful to dig in). |
@overflowz The main holdup right now is that I haven't dug into it, but it might be skirted with some |
Does handling webContents 'new-window' event solve the preload issue? https://electron.atom.io/docs/api/web-contents/#event-new-window |
I'm not sure where to put this, and I'm open to this being moved to a Wiki if that makes more sense. In the interest of having all of the big (and possibly breaking) features/nice-to-haves for the next big release in one spot:
iframe
support and management - Interacting with elements inside an iframe #203, Enable support for IFrames, fixes #203 #496IPC safety - Simultaneous calls to the same action can cause early returns/continues with the wrong results #493, Callback-based IPC #579.goto()
optionally returning afterDOMContentLoaded
There may be a need for:
Nice to-haves:
What have I missed in features, needs, or linked issues?
edit: added element
The text was updated successfully, but these errors were encountered: