schickling/chromeless
View on GitHubFull page reload after action seems to mess with the execution
Open
#86 opened on Jul 28, 2017
APIbughelp wantedtesting/coverage
Description
Hello! I was running trying to run a small script based on your google's JSON search results example.
So my small change was using it to go to npmjs.com instead, and do a search for chromeless package, but when I execute this line, it returns a timeout error while waiting for '.search-results' element to pop up.
const { Chromeless } = require('chromeless');
async function run() {
const chromeless = new Chromeless()
const links = await chromeless
.goto('https://www.npmjs.com')
.type('chromeless', 'input[name="q"]')
.press(13)
.wait('.search-results')
.evaluate(() => {
// this will be executed in headless chrome
const links = [].map.call(
document.querySelectorAll('.search-results li'),
item => {
const { innerText: title, href } = item.querySelector('a.packageName');
return { title, href };
}
)
return JSON.stringify(links)
})
console.log(links)
await chromeless.end()
}
run().catch(console.error.bind(console))
Since that's the current behavior, I assume that chromeless works perfectly for SPAs but not so great for traditional full-page reload navigation style websites.
Is my assumption correct? If so, is there a workaround? If not and there's a step I'm missing, please lemme know.
Thanks!