Selector added by ajax script doesn't fire snapshot
See original GitHub issueI’ve this case where when the page loads it fire a ajax request using some parameters passed with #! and then, once has done it adds a div#rmp-done
, I set up htmlSnapshots like this to wait for that selector:
var htmlSnapshots = require('html-snapshots');
var result = htmlSnapshots.run({
input: "array",
source: [
"mysite/something/#!/first_param"
],
outputDir: "./snapshots",
outputDirClean: true,
selector: "#rmp-done"
});
but I wait a lot and then fails with no output.
The javascript file is a simple jQuery script that call $.ajax to an url and fetch some data then once has done it append the data and div#rmp-done to the body.
Is possible to do trigger the snapshot when the ajax call has finished? (with a timeout callback works fine)
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
$('') selector not working after ajax call - Stack Overflow
After the ajax call the console.log fires, but the fadeIn does not. I've tested directly adding $('img').fadeIn(200) to the init function and ...
Read more >jQuery.ajax() | jQuery API Documentation
A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with...
Read more >JavaScript - Bootstrap
js contain all plugins in a single file. Include only one. Plugin dependencies. Some plugins and CSS components depend on other plugins. If...
Read more >Handling common JavaScript problems - MDN Web Docs
For a start, the JavaScript console will report errors in your code. Make a local copy of our broken-ajax.html example (see the source...
Read more >jQuery AJAX Methods - W3Schools
jQuery AJAX Methods. AJAX is the art of exchanging data with a server, and update parts of a web page - without reloading...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
How I tested was to just insert output statements into the installed code. Quick and dirty results.
If you’re interested:
Many thanks for the tips! I will spent time on it! After seeing strange things on my windows machine I decided to try on a linux based environment and I realized is a lot verbose and I really don’t know why but on windows was behaving strangely :[ that’s why previously I suggested for more verbosity because the same script wasn’t returning anything as output when I was trying on windows. Also there was a couple of bugs (maybe related to my windows environment) once is this:
after opening a snapshot with a editor to watch it.
And when I used an array of sources, it always did one and no more. (always on windows), in linux the same script run through all of them.
In linux is working like a charm I will continue on this. Many many thanks great 📦 again!!