0

I am really new to android and I am building an app that will take the username and password of a website(https://lms.mrt.ac.lk).

When the user hits the login button of my android app, the app should itself logged in to the above website and retrieve the complete(including js generated html) html source code.

As a start I tried to print the html source code in the android studio. I tried to use HtmlUnit, but later I found that it is not supported by android. Then, I tried to use Selenium on android, but when tried to build the project it gave me an error "More than one file was found with OS independent path 'META INF' ".

And then tries android's WebView to do the thing, as described in this question, but I don't know how to view the complete html output.

So, my question is -

  • How to login to a website inside an android app
  • How to get the complete html source code of the logged in website in android(scraping the js)

I want to do the above in same app. I searched everywhere and still could not find anything complete, that helps a beginner. Please help me! your suggestions/solutions are highly appreciated.

1 Answers1

0

I'll answer your questions in order.

  1. I don't know what javascript android framework you are using, but the solution should be similar to the java solution. For your specific website, the login endpoint is https://lms.mrt.ac.lk/login.php. You should send a POST request to the endpoint with header parameters LearnOrgUsername and LearnOrgPassword. On success, this should return your desired LoginSessionCookies.

  2. Instead of trying to interpret the javascript stuff, you should rather try to understand how the javascript code retrieves the information you need. And then directly access your information by a web request.

Community
  • 1
  • 1
  • 1
    Thank you Mark Seibert for your suggestion. Actually login to the web site was ok. I just need a table generated from javascript in the https://lms.mrt.ac.lk/enrolments.php page. I will try to underastand how that table is populated from javascript. Thank you very much! I actually voted for your answer but my reputation is less than 15 so it will not display. Sorry for that! – Sachith Kasthuriarachchi Jan 20 '20 at 05:11