1.å¦ä½ä½¿ç¨HttpClient
2.java关于在程序中实现网页操作的源码问题,坐等!源码php灵签源码
3.å¦ä½è·åç½ç«jså¾çå¦ä½è·åç½ç«jså¾ç
å¦ä½ä½¿ç¨HttpClient
ä¸ãç®ä»
HttpClientæ¯Apache Jakarta Commonä¸çå项ç®ï¼ç¨æ¥æä¾é«æçãææ°çãåè½ä¸°å¯çæ¯æHTTPåè®®ç客æ·ç«¯ç¼ç¨å·¥å ·å ï¼å¹¶ä¸å®æ¯æHTTPåè®®ææ°ççæ¬å建议ãHttpClientå·²ç»åºç¨å¨å¾å¤ç项ç®ä¸ï¼æ¯å¦Apache Jakartaä¸å¾èåçå¦å¤ä¸¤ä¸ªå¼æºé¡¹ç®CactusåHTMLUnité½ä½¿ç¨äºHttpClientã
äºãç¹æ§
1. åºäºæ åã纯åçjavaè¯è¨ãå®ç°äºHttp1.0åHttp1.1
2. 以å¯æ©å±çé¢å对象çç»æå®ç°äºHttpå ¨é¨çæ¹æ³ï¼GET,源码learun源码示例 POST, PUT, DELETE, HEAD, OPTIONS, and TRACEï¼ã
3. æ¯æHTTPSåè®®ã
4. éè¿Http代ç建ç«éæçè¿æ¥ã
5. å©ç¨CONNECTæ¹æ³éè¿Http代ç建ç«é§éç.test;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.List;
import javax.net.ssl.SSLContext;
import org.apache.ment = new StringBody("A binary file of some kind", ContentType.TEXT_PLAIN);
HttpEntity reqEntity = MultipartEntityBuilder.create().addPart("bin", bin).addPart("comment", comment).build();
/s?wd=WebDriver&ie=utf-8";
try {
HttpURLConnection ponentsseparatedbystring:@]];
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
}
åªäºæ¹æ³å¯ä»¥è·åhttpä¸çcookieï¼
ä¸è¬çç½é¡µé½è½è·åãæ两ç§åæ³
1.å¨æµè§å¨çå°åæ è¾å ¥ï¼javascript:alert(document.cookie)(ä¸åºå大å°å)ï¼å°±ä¼å¼¹åºä½ å¨å½åç½é¡µç»å½çcookieä¿¡æ¯ã
2.æFè¿å ¥æµè§å¨çå¼åè 模å¼ââconsoleââå¨å½ä»¤è¡è¾å ¥javascript:alert(document.cookie)ï¼åå车
ç¨htmlunitæä¹å»è·åä¸ä¸ªæJSå è½½çç½é¡µä¿¡æ¯ï¼
æ两ç§æ¹å¼ä¾éæ©ææ¨è第ä¸ç§ï¼ä¸ï¼å»é 读ç¸å ³çç½é¡µéçjsåç½é¡µè¯·æ±ä¹åçheaderï¼éè¿handerç¥éè¿ä¸ªè·åè¿ä¸ªä¿¡æ¯çæ¥å£ãéè¿httpclientæ¥è·ç¥ä½ æ³è¦çä¿¡æ¯ã
äºï¼éè¿htmlunitæ¡æ¶æä¾çæ¹æ³ï¼JavascriptExecutorjsExecutor=(JavascriptExecutor)driver;jsExecutor.executeScript(LoginSubmit();,);è¿éçLoginSubmitå°±æ¯é¡µé¢éçjsæ¹æ³å称ï¼é¡µé¢éè¦æè¿ä¸ªjsæ¹æ³ï¼å½ç¶ä½ ä¹å¯ä»¥èªå·±åä¸äºjsï¼ãç¶åéè¿domæä½æ¥è·åä½ æ³è¦çä¿¡æ¯ã
html5æè JSææ ·è°ç¨ææºæå头æè ç¸åï¼
inputtype="file"accept="video/*;capture=camcorder">inputtype="file"accept="audio/*;capture=microphone">inputtype="file"accept="image/*;capture=camera">ç´æ¥è°ç¨ç¸æºinputtype="file"accept="image/*"/>è°ç¨ç¸æºå¾çæè ç¸åè¿æ¯è¦æ ¹æ®ææºçç±»åæ¥è¯´ï¼æäºææºåªè½è°ç¸æºï¼æäºææºåªè½è°ç¸åï¼æè 两è é½è¡ã以ä¸ï¼å¸æè½å¸®å©å°ä½ ã
ç¬è«å¦ä½è·åç½é¡µcssæ ·å¼ï¼
1ãéè¿ä¿åç½é¡µå³å¯è·åæ³è¦å¯¹åºé¡µé¢ä¸é¢çjsãcssæ件ï¼æçjsãcss被ç¼è¯æå缩è¿é¡»è¦åå©ç¬¬ä¸æ¹å·¥å ·æ¥åç¼è¯ææ ¼å¼åï¼
2ãæå¼æµè§å¨çå¼å模å¼ï¼ä¸è¬æå¿«æ·é®få°±å¯ä»¥æå¼ï¼ä»¥googleæµè§å¨ä¸¾ä¾ï¼ç¹å»æ ç¾resourceï¼ç¶åå¨å¯¹åºçèµæºæ件ä¸æ¾å°èªå·±éè¦çæ件åå³é®saveå³å¯ã
å¦ä½è·åä¸ä¸ªç½é¡µå®æ´çHTML代ç ï¼
å¨é¡µé¢ä¸å³å»æ¥çç½é¡µæºä»£ç å¯ä»¥å¾å°å¼å ¥çcssåjséè¦åç¬æ¾å°å¤å¶ä¸æ¥