반응형

C# -- IE automation #6 -- 구글 검색창 제어하기


참고 : https://msdn.microsoft.com/ko-kr/library/aa752541(v=vs.85).aspx  --> IHTMLDocument3 interface

       https://msdn.microsoft.com/ko-kr/library/aa703928(v=vs.85).aspx  --> IHTMLElementCollection interface  -- item

       http://www.csharpstudy.com/Practical/Prac-IE.aspx 

       http://blog.clockahead.com/2015/06/cie-8.html



부제 :  HTML 태그 속성 제어하기

    - setAttribute() 사용법 익히기

- 버튼 클릭하기.



<< 미션 >>

internet explorer (IE) 에서 구글 검새창을 연후에, 검색어에 "푸들" 입력하고 클릭버튼 눌러서 검색 결과 확인하기.




** IE 8 에서는 id 없어서 name 으로 구글 검색 박스 찾고, IE 11 에서는 id 표시되어 id 로 검색 입력박스 찾는다.

   ( 우연히 발견함... but, IE 9, IE 10 은 안해봐서 모름.....)




** 소스 52번째 줄은 3가지 방법중 하나로 대신할수 있다.


var doc = IE.Document as mshtml.IHTMLDocument3;


// ----- 아래 3가지 방법 모두 가능...

mshtml.IHTMLElement q = doc.getElementsByName("q").item("q", 0);

// mshtml.IHTMLElement q = doc.getElementsByName("q").item(index:0);

// mshtml.IHTMLElement q = doc.getElementsByName("q").item(Type.Missing, 0);





반응형
Posted by 자유프로그램
,