LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-17-2014, 12:45 AM   #1
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,963

Rep: Reputation: 271Reputation: 271Reputation: 271
Automating the execution of a javascript


I found a good standalone javascript interpreter (PhantomJS) and have written a few scripts that it can execute. I want to execute automatically what a page does (specifically, the county assessor's page that returns records for a parcel by its id). The page has a bunch of scripts, most of them not labeled, including the function I want. Can someone point me to some instructions on how to tease out of a page the functionality one wants?

If scripts aren't labeled do they execute in the order they appear in a page? Or must there be an event (e.g., a key click or a mouse rollover)?
 
Old 01-18-2014, 01:07 AM   #2
RootMason
Member
 
Registered: Oct 2012
Location: Tucson, AZ
Distribution: Debian/CentOS
Posts: 124

Rep: Reputation: 5
I would like to help, but I'm not sure I understand the question. Can you expand on this?
 
Old 01-18-2014, 01:22 AM   #3
RootMason
Member
 
Registered: Oct 2012
Location: Tucson, AZ
Distribution: Debian/CentOS
Posts: 124

Rep: Reputation: 5
I'll try and answer what I think the question is. I don't know of any way to tease script functions out of a webpage. When I want to take a function from a page I find somewhere else, I use Firefox's Web Developer > Inspector function. It will show you the page code and, as you hover over parts of the page, you can see what sections of code correspond to what on the page. Firefox also has a neat addon, Firebug, which can accomplish the opposite, where when you hover over a section of code it will show what it corresponds to on a page.

As for scripting on a page, they can be event driven, ordered or unordered. Unordered & non-event driven would usually mean they just load up as they load up, top to bottom, but showing up whenever they finish loading.

Does this help at all?

Steve
 
Old 01-18-2014, 01:26 AM   #4
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,963

Original Poster
Rep: Reputation: 271Reputation: 271Reputation: 271
I want to fetch the ownership records of 167 parcels. I could fetch them all by hand; I'd rather not. The county assessor, who keeps the records, the website used to use a fetching mechanism I could automate the fetching of records from with lynx and the right argument. Now it uses javascript. The button of the page that activates the fetching of a record is a function, _doPostBack(SomeLongArgument) , inside an unlabeled script in a webpage.

I want to make that button do its work with an argument I specify. The button is inside an unlabeled javascript. From the examples on phantomjs.org it seems that I would use phantomjs to 'load' the page (load may not be the right word) and cause the execution of this script. But the script isn't labeled. (Some are.) If a javascript has a URI I can just execute it, but this javascript is in a page and has no label: how do I get it to execute? Pass it an argument?
 
Old 01-18-2014, 02:06 AM   #5
RootMason
Member
 
Registered: Oct 2012
Location: Tucson, AZ
Distribution: Debian/CentOS
Posts: 124

Rep: Reputation: 5
Sorry, I did some research, but didn't come up with anything useful on injection without a URI. I will look further tomorrow.

Steve
 
Old 01-18-2014, 02:11 AM   #6
RootMason
Member
 
Registered: Oct 2012
Location: Tucson, AZ
Distribution: Debian/CentOS
Posts: 124

Rep: Reputation: 5
Everything points to needing that URI to execute against. I don't have time tonight to look further, but perhaps there is a way of injecting the URI? What is your opinion on that?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Automating execution of commands inside a program deeptisjains Linux - Newbie 1 01-02-2012 12:21 AM
Automating access to interactive sites which use HTML and javascript tbgclark Linux - Software 5 03-20-2011 02:39 PM
Looking for Textbrowser with JavaScript Support or Elink Javascript Support rohezal Linux - Software 4 09-01-2009 01:02 PM
Ubuntu Edgy/Firefox 2/Javascript - Firefox closes accessing websites with Javascript Interdictor Ubuntu 8 11-02-2006 11:58 AM
Automating PINE Kedelfor Programming 1 05-22-2005 01:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration