硒到Android项目 [英] Selenium into android project

查看:225
本文介绍了硒到Android项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我单击按钮并在javascript工作后,我想基于javascript和内容加载来解析HTML页面.我使用Jsoup库,Selenium在Java上的PC上创建我的应用程序.我希望它可以在android上运行.我将Selenium添加到新的Android应用程序项目中,并在gradle中添加了依赖项:

I want to parse HTML page base on javascript and content load when I clicked on buttons and after javascript worked. I make my application on PC on Java using libs Jsoup, Selenium. I want it works on android. I added Selenium to new my Android application project and added dependencies in gradle:

compile 'org.seleniumhq.selenium:selenium-htmlunit-driver:2.48.2'

但是我看到很多相同的消息:

But I see many same messages:

Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is
ignored for debug as it may be conflicting with the internal version
provided by Android. In case of problem, please repackage it with 
jarjar to change the class packages

我尝试为Android添加httpclient后:

After I try to add httpclient for android:

compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'

但是它不起作用.有1个错误:

But it not works. There is 1 error:

Error:Execution failed for task ':app:preDexDebug'. > 
com.android.ide.common.process.ProcessException: 
org.gradle.process.internal.ExecException: Process 'command 'C:\Program 
Files\Java\jdk1.8.0_60\bin\java.exe'' finished with non-zero exit value 1

如何将Selenium包含到android项目中以基于Javascript解析HTML? 或者 如何在没有Selenium的情况下基于JS解析HTML? 谢谢.

How to include Selenium to android project for parse HTML base on Javascript? or How to parse HTML base on JS without Selenium? Thanks.

推荐答案

问题无法解决,但我发现嗅探器浏览器的HTTP-get请求和服务器后响应包含了带有所需数据的JSON.关闭.

problem does not solve, but I find HTTP-get request by sniffer browser and server post response which contains JSON with data that I needed. close.

这篇关于硒到Android项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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