安卓/ Java的:模拟在这个网页上点击 [英] Android/Java: Simulate a click on this webpage

查看:331
本文介绍了安卓/ Java的:模拟在这个网页上点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

去年我提出,取消对我的火车公司的信息在比利时的Andr​​oid应用程序(应用程序BETrains:的 http://www.cyrket.com/p/android/tof.cv.mpp/

Last year I made an Android application that scrapped the informations on my train company in Belgium ( application is BETrains: http://www.cyrket.com/p/android/tof.cv.mpp/)

该应用程序是真的很酷,并允许用户在火车上与其他人交谈(一messagery服务器是由我拼命地跑)和对话也目不转睛地在Twitter上:的 http://twitter.com/betrains

This application was really cool and allowed users to talk with other people in the train ( a messagery server is runned by me) and the conversations wre also on Twitter: http://twitter.com/betrains

每个人都在比利时喜欢它。该公司试图避免我们使用他们的数据,使一些用户的网站关闭,但他们是一些律师认为,攻击的公司,最终我们也没有更多的问题和网站是开放的: http://blog.tuinslak.org/2010/07/irail-is-back

Everybody in Belgium loved it. The company tried to avoid us to use their data, make some users websites closed, but their was some lawyers that attack the company and finally we have no more problems and the websites are open: http://blog.tuinslak.org/2010/07/irail-is-back

所以,法律上我的应用程序(目前)完全正确和合法的,但我没有得到任何的火车公司的帮助。

So, legally my application is ( for now) totally correct and legal, but I get no help from the train company.

所以我的问题是有点帮助,以获得DATAS。我现在是一个Android / Java的初学者,花几个星期,试图找到一个解决方案,但也许人们喜欢将FINT在数分钟再予。

So my question is a little help to get the datas. I am now an android/java beginner and spend some weeks to try to find a solution, but maybe people like will fint it in a few minuts.

所以,问题是下一个。你可以看看下面的网址,你会发现2个城市内的URL名称:上的日期和时间蒙斯和图尔奈,也是信息。这是工作的老方法一年:

So the problem is the next one. You may have a look at the following URL, and you will find 2 cities names within URL: Mons and Tournai, and also informations on the date and time. That was the old method that worked one year:

http://hari.b-holding.be/Hafas/bin/query.exe/en?&REQ0JourneyStopsS0A=1&REQ0JourneyStopsS0G=MONS%20[b]&REQ0JourneyStopsZ0A=1&REQ0JourneyStopsZ0G=TOURNAI%20[b]&REQ0JourneyDate=27.010.10&REQ0JourneyTime=19:030&Timesel=depart&ViaName=&ViaMode=NEE&DateMode=ANDERS&PLANNER=TRUE&start=1&queryPageDisplayed=yes

http://hari.b-holding.be/Hafas/bin/query.exe/en?&REQ0JourneyStopsS0A=1&REQ0JourneyStopsS0G=MONS%20[b]&REQ0JourneyStopsZ0A=1&REQ0JourneyStopsZ0G=TOURNAI%20[b]&REQ0JourneyDate=27.010.10&REQ0JourneyTime=19:030&Timesel=depart&ViaName=&ViaMode=NEE&DateMode=ANDERS&PLANNER=TRUE&start=1&queryPageDisplayed=yes

但现在,网址给我一个确认页面,我要确认按钮点击进入下一个页面。

But now, the URL bring me on a confirmation page and I have to click on the confirm button to get to the next page.

所以,我的code将无法正常工作了,我需要点击这个按钮编程到正确的网页到达。

So my code won't work anymore, I need to click on this button programmatically to arrive on the correct webpage.

你有没有关于如何模拟这个按钮,点击任何想法?现在我的code是经典的报废code给定的顶部几行的URL。我假定网址给我的结果页面。那是,直到上周的情况。

Have you any idea on how to simulate a click on this button? For now my code is the classic scrapping code with the URL given a few line on the top. I assumed that the Url give me the result page. That was the case till last week.

DefaultHttpClient httpclient = new DefaultHttpClient();
        HttpGet get = new HttpGet(mon_url);
        HttpResponse response;
            try {
                  response = httpclient.execute(get);
                  HttpEntity entity = response.getEntity();        
                  BufferedReader buf = new BufferedReader(new InputStreamReader(entity.getContent()));
                 etc...

你有没有关于如何提高code什么想法?

Have you any idea on how to improve the code?

由于软件是免费的,我不能发送贝宝的钱,而是一个整体的国家会真的心存感激的人,可以帮助!

As the software is free, I cannot send paypal money, but a whole country would be really thankfull to the man that might help!

感谢了很多。

推荐答案

而不是试图自动点击JavaScript的按钮,尝试监视哪些请求被发送,然后在你的应用程序复制此。有各种Firefox扩展,可以帮助你做到这一点,如 TamperData 萤火虫和的 LiveHttp

Instead of trying to automate clicking the JavaScript button, try monitoring what request is sent and then replicate this in your app. There are various firefox extensions that will help you do this, such as TamperData, Firebug, and LiveHttp.

这篇关于安卓/ Java的:模拟在这个网页上点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆