These are chat archives for rosshinkley/nightmare

21st
Apr 2016
Rick Medina
@rickmed
Apr 21 2016 03:07
guys is there a way to execute a script, keep the browser opened when ended and then reattach to that browser session with another script?
Ross Hinkley
@rosshinkley
Apr 21 2016 03:09
no, at least not yet
we've talked about it briefly in segmentio/nightmare#579 most recently
the idea there was to have one Electron instance manage multiple BrowserWindow instances, though
i don't know if we've ever touched on reattaching to the same instance... are you thinking that the instance should be recycled and started from scratch or picked up where you left off?
Rick Medina
@rickmed
Apr 21 2016 03:11
pick up where you left off
Ross Hinkley
@rosshinkley
Apr 21 2016 03:11
can you describe your use case?
Rick Medina
@rickmed
Apr 21 2016 03:14
let's say you have a script but you have a wrong css selector or whatever and nightmare stops/errs, instead of closing the window, you would execute another script that uses that opened instance
in selenium driver, there's the concept of attaching to opened browser windows
Ross Hinkley
@rosshinkley
Apr 21 2016 03:16
"wrong css selector" shouldn't cause nightmare to completely bomb out (unless you're talking about .type() or .insert()0
Rick Medina
@rickmed
Apr 21 2016 03:17
yeah, that was a stupid example, but the ability to just start with another script on the same instance that the previous script left off (without calling .end() obvisously bc that would close the instance)
rosshinkley @rosshinkley thinks
Ross Hinkley
@rosshinkley
Apr 21 2016 03:19
i assume you are doing this to avoid passing the instance around
Rick Medina
@rickmed
Apr 21 2016 03:20
maybe there's something I don't get about nightmare but I'll try again...
Ross Hinkley
@rosshinkley
Apr 21 2016 03:20
(actually, by the by, bad selectors in .type() or .insert() wouldn't necessarily bomb, but it would send text to the last focused thing)
(until segmentio/nightmare#585 is released)
anyway, if you've got a more complete example, i'd be happy to help :)
Rick Medina
@rickmed
Apr 21 2016 03:22
let's say I have a huge script but I have a type error almost at the end of the script, so I would want to test if the script works but not run it from the start (+), so I would only run a small script that reattaches to the session where the last script failed
EDIT: + since it's huge so I don't want to wait for it to execute all the parts that I know work
Ross Hinkley
@rosshinkley
Apr 21 2016 03:24
you mean like... at testing/development time?
Rick Medina
@rickmed
Apr 21 2016 03:24
yes
Ross Hinkley
@rosshinkley
Apr 21 2016 03:24
i'm following now... hm.
in the eventual implementation, i'm struggling to think of why such functionality wouldn't work...
but probably not something immediately solvable
that said, thanks for pointing out the use case
Ross Hinkley
@rosshinkley
Apr 21 2016 03:30
and apologies :)
Rick Medina
@rickmed
Apr 21 2016 03:31
ok...FYI how selenium webdriver works is that it exports a session ID where you can connect later on a future script
no apologies needed
please...
another question
Ross Hinkley
@rosshinkley
Apr 21 2016 03:31
shoot
Rick Medina
@rickmed
Apr 21 2016 03:32
I have several user needs for iframes...I've read some issues and PRs, will that be released anytime soon?
Ross Hinkley
@rosshinkley
Apr 21 2016 03:36
that's... tricky, as the iframe manipulation pr (segmentio/nightmare#496) covers only a handful of cases with actions, which makes me a little hesitant to pull it in
i need to carve out the time to see if it can be made into a plugin
Rick Medina
@rickmed
Apr 21 2016 03:37
wouldn't be useful to release it with the caveats until a complete solution is found?
Ross Hinkley
@rosshinkley
Apr 21 2016 03:37
and if not, i think i'd rather modify .action() to account for whatever is missing to make that PR a plugin
Rick Medina
@rickmed
Apr 21 2016 03:38
oh so you want to make it a plugin, why?
Ross Hinkley
@rosshinkley
Apr 21 2016 03:38
the core of nightmare is intentionally lean (although not as lean as it probably could be)
Rick Medina
@rickmed
Apr 21 2016 03:40
but in reality it will never be lean since its coupled with electron which is comparably huge, no?
Ross Hinkley
@rosshinkley
Apr 21 2016 03:40
lean in terms of API surface :)
sizewise, yeah, i don't think it'll ever not be big
Rick Medina
@rickmed
Apr 21 2016 03:41
got it, lol
Ross Hinkley
@rosshinkley
Apr 21 2016 03:41
i'd prefer to keep it that way
Rick Medina
@rickmed
Apr 21 2016 03:41
IMHO iframe management is super important on these kind of tools...
are there other plugins for nightmare?
Ross Hinkley
@rosshinkley
Apr 21 2016 03:42
certainly
... hang on, links in a sec
also, i should warn you, i've written a good chunk, and these are the ones i know about offhand
Rick Medina
@rickmed
Apr 21 2016 03:45
yeah I just want to get a grasp of what kind of functioanlity exist outside the core and the separtion concept you are maintaining (core-plugin)
there's also an inline download plugin
there are probably others
Rick Medina
@rickmed
Apr 21 2016 03:46
oh yeah, and I think I saw somewhere a window plugin for things like alerts and such right?
Ross Hinkley
@rosshinkley
Apr 21 2016 03:46
i wrote another one for popups
but i never published it to NPM
window manager, for what it's worth, not sure if that's what you're thinking of
it's a kind-of-sort-of precursor the earlier conversation about window management
Rick Medina
@rickmed
Apr 21 2016 03:47
yeap, that one (which I also)
does nightmare core support popups, alerts, etc?
Ross Hinkley
@rosshinkley
Apr 21 2016 03:49
if you're referring to system dialogs - alert, confirm and choice? yes
but memory serving, you have to write your own preload
well, you have to write your own preload if you want to override the default behavior
Rick Medina
@rickmed
Apr 21 2016 03:53
awesome project btw, been following for a while now, I'd love to use it more but I'm (personally) missing the iframe and reattaching session stuff that I get in selenium
Ross Hinkley
@rosshinkley
Apr 21 2016 03:53
:)
Rick Medina
@rickmed
Apr 21 2016 04:01
I'll keep an eye if those things get implemented soon, thanks for the quick responses! @rosshinkley
Ross Hinkley
@rosshinkley
Apr 21 2016 04:02
np, here to help :)