내가 그것을 내가 웹 클라이언트에게C 번호 - HTML 페이지를 렌더링 받기
using (var client = new WebClient())
{
var content = client.DownloadString("my_site_address");
}
를 사용하려고 먼저
브라우저에 표시되지만 내 사이트에 내가 몇 가지를 가지고 내 사이트에서 HTML 문자열을 얻기 위해 노력하고 있어요 보기를 변경하는 자바 스크립트 코드 (및 webClient가 자바 스크립트를 실행하지 않음)
그래서 wpf WebBrowser를 사용하고 원하는 사이트에 nevigate 한 다음 (예상대로) 페이지를 표시하지만 HTML 문자열을 얻으려고하면 웹 클라이언트는
입니다. dynamic doc = MainBrowser.Document;
var htmlText = doc.documentElement.InnerHtml;
이 10 내가 html로 얻는 방법은 다음과 같습니다
<!DOCTYPE html>
<head>
<title>Title</title>
</head>
<body>
<div class="conteiner">
<div class="matrix">
<script type="text/javascript">
// some script code
</script>
<script type="text/javascript" src="xxx"></script>
<a href="Matrix/index.html">Matrix</a>
</div>
<div class="zoom">
<a href="zoom/index.html">Zoom</a>
</div>
</div>
<div class="test">
<script type="text/javascript">
// some script code
</script>
<script type="text/javascript" src"xxx2"></script>
</div>
</body>
</html>
를이 내가이 자바 스크립트 변경 후 그것을 얻을 방법입니다 :
<html><head>
<title>Title</title>
</head>
<body>
<div class="conteiner">
<div class="matrix">
<script type="text/javascript">
</script>
<script type="text/javascript" src="xxx"></script><iframe ></iframe><script ></script><div ><div ><iframe >
<html><head>
<title></title>
</head>
<body>
<div >
<ul><li><ol><li <a </a></li></ol></li></ul> </div>
</body></html>
</iframe></div></div></div>
<a href="Matrix/index.html">Matrix </a>
</div>
<div class="zoom">
<a href="zoom/index.html">Zoom</a>
</div>
</div>
<div class="test">
<script type="text/javascript">
</script>
<script type="text/javascript" src="xxx2"></script><div ><div ><div ><iframe ></iframe></div></div></div>
</div>
</body></html>
도와주세요 :)
사용하는 도구를 사용하여이 작업을 수행 할 수 없습니다. – Hogan
서버 측이 아니라 클라이언트 측에서이 작업을 수행해야 할 수 있습니다. – ariscris
당신의 최선의 방법은 당신이 그것을 검색 한 후에 C#에서 자바 스크립트 함수를 재 작성하고 html을 처리하는 것입니다. – Banana