1.å¦ä½è·åç½ç«jså¾çå¦ä½è·åç½ç«jså¾ç
2.java关于在程序中实现网页操作的网页网页问题,坐等!源码源代源码ai智能
å¦ä½è·åç½ç«jså¾çå¦ä½è·åç½ç«jså¾ç
å¦ä½éè¿jsè·åç½é¡µä¸çææå¾ç并å å ¥ç¹å»äºä»¶å®ç°å è½½ç½é¡µæ¶ï¼è·åå¾ç并添å ç¹å»éè¿jsçè¯å«æ¹æ³ã-(void)webViewDidFinishLoad:(uiwebView*)webView{
[IDProgressHUDIDPlaceViewHideDirect:self.view]ï¼
//è¿éæ¯jsï¼ä¸»è¦ç®çæ¯è·åurlã
éæNSString*constjsGetImages=
@
varobjs=document.getElementsByTagName(img);varobjs=document.getelementsbytagname(
varimgScr=;varimgScr=;
for(varI=0ï¼æ
imgScr=imgScrobjs[i]ãsrc;
};
returnimgScr;è¿åimgScr
};
[webViewstringbyevaluationjavascriptfromstring:jsGetImages]ï¼//æ³¨å ¥jsæ¹æ³
nsstring*urlResurlt=[webViewstringbyevaluationjavascriptfromstring:@getImages()];
mUrlArray=[NSMutableArrayarraywitharray:[urlResurltcomponentsseparatedbystring:@]];
if(murlarray.count=2){
[mUrlArrayremoveLastObject]ï¼
}
//urlResurltæ¯ææè·åå¾ççURLçæ¼æ¥ï¼MUrlArrayæ¯ææURLçæ°ç»ã
//ç¹å»jsæ·»å å¾ç
[mWebViewstringbyevaluatingjavascriptfromstring:@å½æ°registimageclickaction(){
varimgs=document.getElementsByTagName(img);varimgs=document.getelementsbytagname(img
varlength=imgs.length;varlength=imgs.length
for(varI=0ï¼æi){
img=imgs[I]ï¼
img.onclick=function(){
window.location.href=å¾åé¢è§:this.src}
}
}
[mWebViewstringbyevaluatingjavascriptfromstring:@registimageclickaction()ï¼
}
//å¨è¿ä¸ªæ¹æ³ä¸ï¼æè·å¾åçç¹å»äºä»¶å被ç¹å»å¾åçurlã
-(BOOL)webView:(UIWebView*)webViewshouldStartLoadWithRequest:(NSURLRequest*)请æ±å¯¼èªç±»å:(UIWebViewNavigationType)导èªç±»å{
//é¢è§å¾ç
å¦æ(ã请æ±ãURL.schemeisequaltostring:@å¾åé¢è§å¾åé¢è§:
path=[pathstringbyaddingpercentescapesusingcoding:nsuTF8stringencoding]ï¼
//pathæ¯è¢«ç¹å»å¾åçurlã
è¿åå¦ï¼
}
è¿åYES
}
åªäºæ¹æ³å¯ä»¥è·å/s?网页网页玩洽源码wd=WebDriver&ie=utf-8";
try {
HttpURLConnection httpUrlConnection = (HttpURLConnection) new URL(url).openConnection();
httpUrlConnection.setRequestMethod("GET");
httpUrlConnection.setUseCaches(true); //使用缓存
httpUrlConnection.connect(); //建立连接
InputStream inputStream = httpUrlConnection.getInputStream(); //读取输入流
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
String string;
while ((string = bufferedReader.readLine()) != null) {
System.out.println(string); //打印输出
}
bufferedReader.close();
inputStream.close();
httpUrlConnection.disconnect();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} //创建连接
}
}