segment-boneyard / nightmare

A high-level browser automation library.
https://open.segment.com
19.55k stars 1.08k forks source link

Chrome is not defined when trying to access window.chrome object #1163

Closed doanchu closed 6 years ago

doanchu commented 7 years ago

Chrome is not defined when trying to access window.chrome object. It seems Electron support some chrome.* APIs. How is it possible that chrome is not defined when using nightmarejs?

matthewmueller commented 6 years ago

Hi @doanchu, this isn't possible in nightmare right now. Nightmare runs on the main frame using the default execution context. Here's a diagram:

image

window.chrome would be available in the extension execution contexts.

Do you know how to set this up in electron? If so, please provide an example and I can help you set it up in nightmare.

matthewmueller commented 6 years ago

Going to close this since this issue is getting stale. Please feel free to reopen if you're still running into this problem and have additional information for us :-)