简体   繁体   中英

How to use Java to sent and read a third party javascript variables

I have two javascript files:

http://www.dublinbikes.ie/design/marseille/javascript/gmaps_common.js
http://www.dublinbikes.ie/design/marseille/javascript/gmaps_search_station.js

Which for http://www.dublinbikes.ie/All-Stations/Station-map# website

What I want to do is to simulate the search a station status action that on the left hand side by set variable 'value' a station number and pass it to gmaps_common.js for execute, then read the result from gmaps_search_station.js that executed variable called html from LeftBlock(id) function.

Because I need run whole process automatically several times, so please suggest me could I use Java to do this and how.

Thank you very much for the help.

You should never try to emulate a JavaScript interpreter just to get js variables out of it - just do the same thing the script would do in your language. Java is mighty enough.

The script just gets a list of stations from http://www.dublinbikes.ie/service/carto , and then queries details from http://www.dublinbikes.ie/service/stationdetails/dublin/ {number} ( example ). Java has lots of HTTP and XML libraries, it will be no problem for you to do that, too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM