简体   繁体   English

什么可以用于Android上的Webcommunication

[英]What can be used for Webcommunication on Android

I am currently building an App for Amazon FireTVStick which should be able to show content of a Website.我目前正在为 Amazon FireTVStick 构建一个应用程序,它应该能够显示网站的内容。 I am using Jsoup for HTML-Parsing and locating the Resources and this is working good and was easy with Jsoup.我正在使用 Jsoup 进行 HTML 解析并定位资源,这很好用,并且使用 Jsoup 很容易。

But now I am stucked at the last step, in which I want to locate the videoLink.但是现在我被困在最后一步,我想在其中找到 videoLink。 The Page uses dynamic JavaScript to load the content and has a wait timer of 10 seconds.该页面使用动态 JavaScript 加载内容,并有一个 10 秒的等待计时器。

Because Jsoup is only a HTML-Parser in the last step i need anything else for the communication.因为 Jsoup 只是最后一步中的 HTML 解析器,所以我需要其他任何东西来进行通信。 I have used Selenium once or twice but on Android it is not possible to use as I want with example FireFoxDriver or am I to dumb.我已经使用过一次或两次 Selenium,但在 Android 上,它不可能像我想要的那样使用 FireFoxDriver,或者我是愚蠢的。 It needs a installation of that driver but the Stick does not have one.它需要安装该驱动程序,但 Stick 没有安装。

Is it possible to use Selenium in any way in Android Studio building a App for FTVS or is there alternative or even a better approach to accomplish what I want ?是否可以在 Android Studio 中以任何方式使用 Selenium 为 FTVS 构建应用程序,或者是否有替代甚至更好的方法来完成我想要的?

I do not want to automate anything on the Android device, just need something for the Webcommunication.我不想在 Android 设备上自动化任何东西,只需要一些用于网络通信的东西。

I hope my problem and intensions are clear.我希望我的问题和意图是明确的。 Thank you in advance!先感谢您!

The Android Webview is what helped me in the last step. Android Webview 在最后一步帮助了我。 It can execute the JavaScript and return the modified HTML which can than be parsed with JSoup.它可以执行 JavaScript 并返回可以用 JSoup 解析的修改后的 HTML。 As for now it is the best solution I could find.至于现在,这是我能找到的最佳解决方案。

Of course you don't want a FirefoxDriver if it's an android system :) Luckily for you there is an Android version of Selenium called Selendroid , check it out at this link .当然,如果 FirefoxDriver 是 android 系统,则您不想要 FirefoxDriver :) 幸运的是,有一个名为Selendroid的 Android 版 Selenium,请在此链接中查看

HTMLUnit is another alternative you might want to consider, it's basically a headless browser with support for JavaScript. HTMLUnit是您可能要考虑的另一种选择,它基本上是一个支持 JavaScript 的无头浏览器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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