In PhantomJS we can wait for resources to do something related to AJAX calls of webpage, but in Electron I could not notice such thing, so I want to know is there anything that can help me to handle AJAX calls in Electron.
Is there methods like waitForUrl or waitForResource from CasperJS
Thanks in advance!
Related
Here's what I'm trying to achieve with my Chrome extension and the issue I'm facing:
My extension runs an ajax call every x minutes to a server and based on the result, displays the updated information in the extension pop-up window.
I was able to implement all of this logic with my ajax call made from popup.js and it works perfectly fine.
The only limitation I currently face is that the extension user has to click on the extension icon for the popup.js/html script to be triggered and executed (which is expected).
- I'm trying to figure how to trigger the ajax call function when the browser is launched.
Solution trial 1: I moved my ajax call and response logic from popup.js to background.js and included a chrome.runtime.onStartup.addListener. The problem with this approach is that background.js can't access my popup DOM and thus I cannot display my updated information.
Solution trial 2: I kept my ajax call and response logic in popup.js. In background.js, I added a chrome.runtime.sendMessage within the chrome.runtime.onStartup.addListener. The problem with this approach is that popup.js is not triggered obviously (no user click on extension icon yet) and thus apparently not able to get the message from background.js to execute the ajax call.
I'm pretty confused with what is the right approach to follow, it feels a bit like an chicken & egg problem.
Any help or feedback would be very much appreciated. Thanks in advance!
P.S: I'm using Manifest V3
I've been trying to login to write a script using CasperJS that logs in to my work's router login page, and I'm a little lost...
The html for the login page is here: https://dl.dropboxusercontent.com/u/30314127/help.rtf
Thanks in advance,
Ronka
I'm not sure anybody is going to write the code you need. Casperjs has pretty good documentation. You need to request the page, find the id's of the login and sendKeys. I haven't run into any issues of not being able to log into a web based application using casper. IF you're completely at a loss I have a video you can watch which enters data into an Ajax application, which shouldn't be too much different than what you're trying to do.
Filling out Ajax forms
One of my pages has about 5 jQuery AJAX calls that fire off as soon as the page loads. I want to track each AJAX call individually and get it an id. How do I do this?
Download the Firefox browser and install the Firebug extension. That will let you track all the XMLHTTP request information for each request (as well as help you with plenty of other debugging issues).
Here's a basic overview: http://getfirebug.com/network
I'm having trouble using AJAX page updates along with other AJAX scripts.
During a normal page load, the AJAX scripts (picture scrolling and picture thumbnails) work fine. But when I update a page with AJAX, these scripts (usually loaded in the header of the initial page load) stop working.
I am wondering if this is specific to these scripts and I need to look into them deeper to resolve/re-write or if I am missing something more generic in combining AJAX page updates with AJAX scripts the returned code relies on.
Embedded javascript runs fine.
Thanks for your ideas!
PS: The scripts I am using are from www.dynamicdrive.com are:
1) stepcarousel (http://www.dynamicdrive.com/dynamicindex4/stepcarousel.htm) and
23) thumbnailviewer (http://www.dynamicdrive.com/dynamicindex4/thumbnail.htm) from the
Try doing this on Firefox, using the Firebug debugger, so you can single-step through and determine what is going on with the javascript. If you are using IE8 then you can hit F12 and bring up the debugger for that environment also.
Once you have some idea what is going on then you can explain what you are seeing, what browsers you have tried and you will get more help.
Hey folks I was wondering if anyone can tip me on a painless way of invoking a modal view controller from a web link in a UIWebView. Is it possible to do this?
I want the modal view controller to still be a part of the app as opposed to closing the main app and using a helper application instead.
Any help would be greatly appreciated.
The best way to do this is by intercepting certain URLs in the UIWebView's delegate function
– webView:shouldStartLoadWithRequest:navigationType:
This can be called from javascript by setting the window's location:
window.location = "mycomprotocall:showMoadViewController";
Parse this in the delegate function, then execute any native code you like.
If you're using vanilla webpages that can be accessed from safari mobile, it is not possible. If you're programming a local webapp with phonegap or similar technologies, it is fairly easy, just catch the urls you want and handle them differently.