You are not logged in.
Recently, I wrote a Python script with Selenium; the ONLY function of selenium was to "click" a Javascript button on a page since, as far as I know, no other Python library will allow for this. This script runs fine on a normal desktop, but it seems that using Firefox/Iceweasel is too resource-intensive on my Pi board, the Chrome drivers don't work (even the ones which claim to be built for ARM), and I don't know of any alternative webdriver that Selenium could use.
Is anyone familiar with effective, lightweight solutions to Javascript automation? It's important to me because it makes finding job opportunities a lot easier; and, I'm pretty annoyed that, for all the effort I've put into this, a single button continues setting me back two steps for every step forward.
Last edited by apolyonn (2014-04-29 16:39:01)
Offline
There used to be a perl library that allowed you to automate web-browsing - not sure if it could cope with javascript. WWW::Mechanize might do it.
Offline
There used to be a perl library that allowed you to automate web-browsing - not sure if it could cope with javascript. WWW::Mechanize might do it.
Thanks for the tip, and I'll definitely look into this. I know that, in Python, the Mechanize library doesn't work with Javascript; that lack of functionality led me to use Selenium. Do you know where I could begin with this? I'm a bit of a novice with Perl.
Offline
Apparently my post was either deleted or never submitted. Fantastic...
edbrowse seems nifty, but I can't find any automation methods.
After a lot of trial and error (this particular "Submit" button doesn't use POST/GET, so Mechanize's browser.submit() is impotent), I did run across this from a chunk of JS code (this looks like jQuery, but I could be wrong):
$(document).ready(function () {
$("#"+"numericalString,#prv,#nxt").click(function () {
blockUIDuringSearch("token","cookie");
document.forms[0].submit();
});
});
I find the "document.forms[0].submit();" portion to be of interest, but I don't know how to simulate it in Python, so I can't confirm/deny if this is what I'm looking for. Any ideas?
Last edited by apolyonn (2014-04-20 19:45:32)
Offline
After running across this article, I was able to solve this issue to my needs by using PhantomJS 1.9 (use at LEAST 1.9, otherwise selenium won't be able to access the GhostDriver) as my webdriver with Selenium. As this is running on my Pi board, I'm using this precompiled armv6l version. It isn't the most ideal solution, but it certainly is a far more effective; with PhantomJS, the whole program takes ~25 second to run, as opposed to the ~4 minutes that it took for Firefox to do the same process -- and, on a normal pc, the script takes only a few seconds to run, as opposed to the ~20 seconds required by Firefox.
I don't have the know-how to do anything more effective (and, to my knowledge, I've exhausted any other resource), so I'll accept this as a solution.
Last edited by apolyonn (2014-04-29 16:38:35)
Offline