onetapinc / chromy Goto Github PK
View Code? Open in Web Editor NEWChromy is a library for operating headless chrome. ๐บ๐บ๐บ
License: MIT License
Chromy is a library for operating headless chrome. ๐บ๐บ๐บ
License: MIT License
I get this error...
Error: Cannot navigate to invalid URL
with this script...
const Chromy = require('chromy')
const path = require('path')
const fs = require('fs')
let chromy = new Chromy({chromeFlags: ['--window-size=600,400'], visible: true});
chromy
.chain()
.goto('examples/myCoolProject/index.html')
.screenshotSelector('html')
.result((png) => {
fs.writeFileSync('./chromyTest.png', png)
})
.end()
.then(_ => chromy.close())
.catch(e => {
console.log(' ' + e);
chromy.close();
});
The pdf example doesn't work for me - disabling the "catch", I get the following error in the console:
Error: PrintToPDF is not implemented
Using Chrome Version 59.0.3071.86 (Official Build) (64-bit)
Hi there @dotneet,
I have a case in which I'm trying to interact with iframe content that's nested within another iframe. While I'm using the .iframe method (of which there doesn't seem to be any API docs), I wanted to make sure that this is supported by chromy. Will the following snippet work to accomplish this?
.iframe('iframe', async iframe => {
await iframe.chain()
.evaluate(async (_) => {
await iframe.chain()
.click('#nested-iframe-button')
.evaluate(_ => {
console.log('Interacting with iframe inside of iframe');
console.log(document.querySelector('#nested-content').innerText)
})
.end()
})
.end()
})
hi @dotneet,
Can I add custom devices? I see source code, the device information is hard coded in devices.js
, and used in index.js
.
If you do not mind, I can submit a pr for this feature~~
Hi @dotneet,
i think this is on chromy but i can't be entirely sure:
Reduced testcase:
const Chromy = require('chromy');
// not headless
let chromy = new Chromy({ visible: true });
//headless
// let chromy = new Chromy();
chromy.chain()
.goto('http://github.com/')
.sleep(500)
.end()
.then(() => chromy.close());
Environment:
Chrome 60
Chromy 0.4.7
Centos 7
Node 8
I think the problem occured first after updating from chrome59 to chrome60 but i can't be sure.
Headless Mode still works. But having the window visible helps a lot when working on complex test cases.
If i manually start chrome via google-chrome --remote-debugging-port=9222
and then run a chrome-remote-interface script against it, everything works and the rendering seems fine.
Reference: garris/BackstopJS#479
It would be very helpful if there were a simple setCookie()
example.
Does this command accept an array in the following format? e.g.
...
chromy.setCookie([
{
"domain": ".www.mydomain.com",
"expirationDate": 1798790400,
"hostOnly": false,
"httpOnly": false,
"name": "abc",
"path": "/",
"sameSite": "no_restriction",
"secure": false,
"session": false,
"storeId": "0",
"value": "renderMode=vanilla",
"id": 112
},
{
"domain": ".www.mydomain.com",
"expirationDate": 1798790400,
"hostOnly": false,
"httpOnly": false,
"name": "xyz",
"path": "/",
"sameSite": "no_restriction",
"secure": false,
"session": false,
"storeId": "0",
"value": "featureFlag=foo",
"id": 112
}
])
...
I have a Chrome extension that I was hoping to use Chromy to load and test. However, since Chromy loads a fresh copy of Chrome on startup (no one signed in, etc.), this appears to be impossible.
Would it be possible to load an extension inside whichever instance Chromy runs?
Hello
I play with backstopJS and chromy seems to bug sometimes.
Maybe Itโs because I try to find a only one selector and itโs not present in the tested page.
ChromyJS returned an unexpected error while attempting to capture a selector. Error: not opened
at WebSocket.send (/home/travis/build/20minutes/colette/node_modules/ws/lib/WebSocket.js:356:18)
at Chrome.enqueueCommand (/home/travis/build/20minutes/colette/node_modules/chrome-remote-interface/lib/chrome.js:115:16)
at /home/travis/build/20minutes/colette/node_modules/chrome-remote-interface/lib/chrome.js:79:28
at Promise (<anonymous>)
at Chrome.send (/home/travis/build/20minutes/colette/node_modules/chrome-remote-interface/lib/chrome.js:78:16)
at Object.handler [as evaluate] (/home/travis/build/20minutes/colette/node_modules/chrome-remote-interface/lib/api.js:32:23)
at Chromy._callee$ (/home/travis/build/20minutes/colette/node_modules/chromy/dist/document.js:400:81)
at tryCatch (/home/travis/build/20minutes/colette/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:65:40)
at Generator.invoke [as _invoke] (/home/travis/build/20minutes/colette/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:299:22)
at Generator.prototype.(anonymous function) [as next] (/home/travis/build/20minutes/colette/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:117:21)
at tryCatch (/home/travis/build/20minutes/colette/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:65:40)
at invoke (/home/travis/build/20minutes/colette/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:155:20)
at /home/travis/build/20minutes/colette/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:198:11
at Promise (<anonymous>)
at callInvokeWithMethodAndArg (/home/travis/build/20minutes/colette/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:197:16)
at AsyncIterator.enqueue [as _invoke] (/home/travis/build/20minutes/colette/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:220:13)
You can se the log of the test here:
https://travis-ci.org/20minutes/colette/jobs/267365456
Just checking here -- is there a regression on relative paths?
I am getting this... Error: Cannot navigate to invalid URL
When I use a relative path.
This is related to garris/BackstopJS#485
Hi,
I would be interested in seeing goto() function sending HTTP response as a promise call back which you could validate based on the response you get (e.g status code)
Any suggestion what would be the best way to achieve this using chromy?
Testing the beta version of backstopjs and noticed that attribute selectors don't work (but they did with phantom).
Error: An error has occurred evaluating the script in the browser.SyntaxError: Unexpected identifier
works:
selectors: [ '.test' ]
doesn't work:
selectors: [ "[data-backstop='test']" ]
Hopefully it's an easy fix! Thanks!
@dotneet This one has been coming up now for a lot of developers.
Do you know why bitmaps taken on my retina laptop would render different text anti-aliasing when attaching non-retina monitors?
Could this have something to do with the process you use to maintain 1:1 resolution across different configurations?
Here are two images taken on the same machine. The reference was created on my laptop -- the test was created on my laptop with an external (non-retina) monitor attached...
Is xpath selector supported or is there any plan to add it?
I can understand smoothly because I have enough knowledge about chrome headless.
but
some developer who doesn't have any basic knowledge about headless chrome might be confused
Depending on his environment he can not proceed next step.
so It's better to add some example for setting up local environment to README.md.
docker run --init -it --rm --name chrome --shm-size=1024m -p=127.0.0.1:9222:9222 --cap-add=SYS_ADMIN \
yukinying/chrome-headless-browser
https://github.com/yukinying/chrome-headless-browser-docker
chrome \
--headless \ # Runs Chrome in headless mode.
--disable-gpu \ # Temporarily needed for now.
--remote-debugging-port=9222
https://developers.google.com/web/updates/2017/04/headless-chrome
Windows
I'm not sure
Might be a regression here too?
After addressing #49 -- when testing with a script using wait() the script hangs.
You can see this with https://github.com/garris/backstop-feature-tests
Running the first scenario noSelectors
hangs waiting for a selector -- testing noSelectors_readyEvent
does work.
@dotneet Hi. What exactly is the command that should close chrome? When my script is complete I still have chrome processes running. Thank you!
In the definition of type
(in src/index.js) the selector is wrapped in double quotes and is not escaped. If there are any unescaped double quotes in the selector name this causes chromy to crash. In all other functions (that I've seen) selectors are wrapped in single quotes and escaped using escapeSingleQuote
(from src/util.js).
Is there any reason why this is the case and could we change this?
When I call screenshotSelector() on element set to {display: none} I get the following error...
(sharp:92706): GLib-GObject-WARNING **: value "0" of type 'gint' is invalid or out of range for property 'width' of type 'gint'
Is it be possible to ensure screenshots are captured at lower resolution -- even on high-resolution devices? Possibly through the emulation setting?
I have a major use-case where I will need to capture selectors which are longer or wider than the viewport. Do you have any suggestions on how this could be implemented?
First of all, thanks for creating this great tool for manipulating the browser api easily, and sorry i am just a newbie, and i wonder what should I do to disable the headless browser to load images ? and is it possible to wrap that sort of relevant event as a function ?
I've researched the document https://chromedevtools.github.io/devtools-protocol/tot/Page/ , and i have no cue where is the right direction may meet my demand. I hope there's a way to solve it. and I'll appreciate if this could be supported. thank you
The test below should return 1.
Running document.querySelectorAll("div.content").length
in the console on google.com returns 1.
It appears the Chromy does not yet support args passed in to evaluate
(like nightmarejs).
let chromy = new Chromy({visible:true})
var selector = "div.content";
chromy.chain()
.goto('https://www.google.com/')
.evaluate( function(selector) {
return document.querySelectorAll(selector).length;
}, selector)
.result((r) => console.log("selector length: " + r))
.end()
.then(_ => chromy.close())
looks like screenshotMultipleSelectors()
may be broken?
$ node -v
v8.1.0
error:
~/Desktop/backstop test @gshipon-mn1(gshipon)
$ node chromyTest
error caught > Error: 'Emulation.resetViewport' wasn't found
script:
chromy
.chain()
.console(function (text, consoleObj) {
if (console[consoleObj.level]) {
console[consoleObj.level]((consoleObj.level).toUpperCase() + ' > ', text);
}
})
.goto('examples/featureTests/index.html')
.wait(1)
.screenshotMultipleSelectors(
["body", "h1", "h2"],
handlescreenshots,
{useQuerySelectorAll: true}
)
.end()
.then(_ => {
chromy.close()
console.log('success');
})
.catch(e => {
chromy.close()
console.log('error caught > ' + e);
});
function handlescreenshots(error, png, index, selectors, sub){
console.log('>>>',error, selectors[index], sub);
fs.writeFileSync(`./screens/${selectors[index]}_${sub}.png`, png);
}
You mentioned here that the Sharp dependency will be going away. I had a user attempt to install yesterday that this was still happening. Can you let me know the status?
I try to type some text into the field that is placed in iframe and I see that there is no 'type()' function available:
This is my code:
await chromy.iframe('iframe#braintree-hosted-field-number', frame => {
console.log('We are inside.');
frame.type('input[name=credit-card-number]', '4111111111111111');
});
I try to create test scenario for Magento e-commerce app.
Looks like .scrollTo() exists, but is not yet documented in the API section.
That is probably applicable to other methods as well, like getPageOffset
.
Hi @dotneet! I am working on the backstop-chromy integration. Things are going great but there is a feature in casperjs that we rely on -- its selector capture...
http://docs.casperjs.org/en/latest/modules/casper.html#captureselector
Is this a feature you could add to chromy?
let chromy = new Chromy({visible:true, typeInterval:100, chromeFlags:['--disable-popup-blocking']});
Pop up blocking still works
I have a use case where I need to watch for a network response.
I need to know the status code of a specific request and take action based on the response value.
Is there support for this?
Hi, in my project, the chromy has multiple tabs, I'm tring to change the activate tab by targetId.
this is my code:
let pages = await chromy.getPageTargets();
let targetPage = pages.filter(p => p.url.indexOf(someKeys) > -1)[0];
await chromy.Target.activateTarget({targetId: targetPage.targetId});
but I got some errors like this:
TypeError: Cannot read property 'activateTarget' of undefined
Is there any way to activate the other tab? Thanks in advance!
Chrome Launcher by default sets handleSIGINT to true which allow termination of chrome process on Ctrl-C
.
I've tried to set this flag explicit, but no result.
Please advise any solution.
Hi @dotneet, I discovered that .wait(fn) runs in the chrome window context. Is there a way to run this in the chromy script context?
Is it possible to use screenshotMultipleSelectors() to capture the viewport?
chromy.screenshot() does have this behavior but the resolution is not normalized.
Also, It would be great if screenshotMultipleSelectors() could accept 'DOCUMENT' and 'BODY' "magic" selectors -- where DOCUMENT would capture the entire document and BODY would capture only the viewport. FWIW: This is a convention used in backstopjs.
Do you have some thoughts?
await chromy.wait('ul.x-list-plain');
I can see this element in browser. But Wait(selector) keeps waiting. Am i missing something?
Hello,
Thanks for Chromy, it's really useful :-)
I have been unable to use a shared variable in a wait function:
const timestamp = 'release-nnn-' + new Date().toISOString();
let chromy = new Chromy( { chromeFlags: [ '--window-size=1200,960' ] } );
chromy.chain()
.goto( 'http://devenv/' )
.click( '#somelink' )
.wait( '#somecontent' )
.type( '#titleField', timestamp )
.wait( function(a,b,c) {
return document.querySelector( '#titkeField' ).innerText.indexOf(timestamp ) > -1;
} )
I get ReferenceError: timestamp is not defined
. I tried to follow examples/define_function.js
to wrap my variable in a function but I couldn't figure out how to get it to work.
Is what I am trying to do possible?
Thanks,
Hi -- thanks for starting this project -- it is very cool!
How would I set the size of the screenshot?
Also, Can you explain why my PDF and PNG screenshots are different for the following example?
const Chromy = require('chromy')
const path = require('path')
const fs = require('fs')
let chromy = new Chromy()
chromy.chain()
.goto('https://google.com/')
.screenshot()
.result((png) => {
fs.writeFileSync('out.png', png)
})
.pdf()
.result((pdf) => {
fs.writeFileSync('out.pdf', pdf)
})
.end()
.then(_ => chromy.close())
.catch(e => chromy.close())
results files attached...
the PDF captures the document size
out.pdf
the PNG captures part of the document
out.png
I'm not sure with repo this issue belongs in.
createBitmaps | Selcted 6 of 6 scenarios.
Starting Chromy: port:9222 --window-size=320,480
Starting Chromy: port:9223 --window-size=1280,768
Starting Chromy: port:9224 --window-size=320,480
Starting Chromy: port:9225 --window-size=1280,768
Starting Chromy: port:9226 --window-size=320,480
Starting Chromy: port:9227 --window-size=1280,768
Starting Chromy: port:9228 --window-size=320,480
Starting Chromy: port:9229 --window-size=1280,768
Starting Chromy: port:9230 --window-size=320,480
Starting Chromy: port:9231 --window-size=1280,768
Error: Failed to launch a browser.
at Chromy.start$ (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\chromy\dist\index.js:147:21)
at tryCatch (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:65:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:303:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:117:21)
at tryCatch (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:65:40)
at invoke (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:155:20)
at C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:165:13
Error: Failed to launch a browser.
at Chromy.start$ (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\chromy\dist\index.js:147:21)
at tryCatch (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:65:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:303:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:117:21)
at tryCatch (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:65:40)
at invoke (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:155:20)
at C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:165:13
Error: Failed to launch a browser.
at Chromy.start$ (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\chromy\dist\index.js:147:21)
at tryCatch (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:65:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:303:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:117:21)
at tryCatch (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:65:40)
at invoke (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:155:20)
at C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:165:13
Error: Failed to launch a browser.
at Chromy.start$ (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\chromy\dist\index.js:147:21)
at tryCatch (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:65:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:303:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:117:21)
at tryCatch (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:65:40)
at invoke (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:155:20)
at C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:165:13
Error: Failed to launch a browser.
at Chromy.start$ (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\chromy\dist\index.js:147:21)
at tryCatch (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:65:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:303:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:117:21)
at tryCatch (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:65:40)
at invoke (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:155:20)
at C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:165:13
Error: Failed to launch a browser.
at Chromy.start$ (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\chromy\dist\index.js:147:21)
at tryCatch (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:65:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:303:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:117:21)
at tryCatch (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:65:40)
at invoke (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:155:20)
at C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:165:13
Error: Failed to launch a browser.
at Chromy.start$ (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\chromy\dist\index.js:147:21)
at tryCatch (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:65:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:303:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:117:21)
at tryCatch (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:65:40)
at invoke (C:\Users\SATTA-WORK\AppData\Roaming\npm\node_modules\backstopjs\node_modules\regenerator-runtime\runtime.js:155:20)
at C:\Users\SATTA-WOR
@dotneet I think this may be a somewhat challenging issue.
I have a document with a height of 1000px and a viewport (window) with a height of only 800px, if I attempt to hover an item which starts at 900px (using mouseMoved()) the hover fails. This makes sense since in normal chrome it is impossible for a user to move the cursor beyond the window bounds. However, it causes confusion when taking screenshots in the document
(whole page) context. This is especially true when using backstop because this was not a limitation of phantom.
I am wondering, would it be possible to maintain the user's intended cursor position (probably by simply aggregating arguments to all mouseMoved() calls) prior to switching to document
context. If so, would it also be possible to set the user's intended cursor position prior to taking screenshots?
This is a pretty big issue for backstop usecases. What do you think?
Hi , i'm trying to integrate chromy with my jasmine E2E testing environment(headless mode) .
this is my chrome conf file .
const Chromy = require('chromy')
const logger = require('../spec/specLogger')
const specUtils = require('../spec/specUtils')
const constants = require('../spec/specConstants')
const colors = require('colors');
const timeout = 2 * 60000
const chromy = new Chromy({waitTimeout: timeout, gotoTimeout: timeout, evaluateTimeout: timeout})
const chrome = chromy.chain();
const runnerNames = specUtils.getRunnerNames();
runnerNames.forEach(runnerName => {
const urlParams = {
query: {
jasmineSpec: constants.jasmineSpec + runnerName,
},
runnerName: runnerName
}
const url = specUtils.createTestUrl(urlParams);
try {
chrome
.goto(url)
.wait(() => window.reporter && window.reporter.finished)
.evaluate(() => window.reporter.specs())
.result(specs => formatResults({url, runnerName, specs}))
} catch (e) {
console.log(e)
}
})
as first look , i thought it should run the tests parallel but it seems it runs sync.
any thoughts how can i run the instances parallel ? thanks in advance!
Sorry if wrong place I am new to github/programming
Is it possible to upload, like say nightmare-upload?
great library,thanks
This is a requirement for many of my use-cases...
.mouseMoved(<selector>, [options])
any chance of getting this?
Hi there,
Love the project. Currently migrating a service from nightmarejs to chromy and it's working great. Just wondering if you're planning on supporting an API similar to Nightmare#inject
or if there is any way to achieve a similar result with the current API.
let Chromy = require('chromy');
let chromy = new Chromy();
chromy.chain()
.goto('https://www.google.com/')
.evaluate(() => {
return document.getElementById('textfield-1012-labelEl').innerText;
})
.result((r) => console.log(r))
.end()
.then(() => chromy.close())
When i launch this code i see a frame of browser and then it disappears.
Currently, chromy.pdf() doesn't take any options. Is it possible to support the options supported by devtools?
https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF
Being able to specify the page height, width, scale and other things would be really helpful.
Hi, thanks for the nice library!
It would be even nicer if it will support accessing/clicking elements inside an iframe. Do you know how to do it via Chrome DevTools Protocol?
First off, thanks for chromy!
Is there a way to open HTML given as a data-URL?
For example, the following doesn't return anything:
chromy
.chain()
.goto('data:text/html,<h1>Hello%2C%20World!<%2Fh1>')
.evaluate(() => {
return document.body.innerHTML;
})
.result((r) => console.log(r))
This is not hard to work around (e.g., passing a string along and setting body.innerHTML
) but it would be convenient to just open the data straight away.
I have a block of code to catch crashes and show the error:
.catch( err => {
console.log( "A problem was detected:" );
console.log( err );
chromy.close();
setTimeout( () => {
process.exit( 1 );
}, 1000 );
} );
It would be really useful if I could take a screenshot at this point. Is there a safe way to do so?
Would it be possible to post a simple .wait(func) example here?
Hi,
Just tried to install chromy and got this error:
npm install chromy
npm ERR! code ETARGET
npm ERR! notarget No matching version found for async-chain-proxy@^0.1.3
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'chromy'
npm ERR! notarget
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/y/.npm/_logs/2017-06-26T14_56_42_085Z-debug.log
For some reason, it can't find async-chain-proxy
with that version? any idea?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.