Created
June 6, 2015 11:24
-
-
Save dck-jp/a30b1dd19820ee7ba903 to your computer and use it in GitHub Desktop.
SHDocVwSample09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void CheckCheckBox() | |
{ | |
var IE = new SHDocVw.InternetExplorer(); | |
IE.Visible = true; | |
object URL = "http://law.e-gov.go.jp/"; | |
IE.Navigate2(ref URL); | |
IE.Wait(); | |
var doc = IE.Document as mshtml.IHTMLDocument3; | |
//1つ目の方法 | |
foreach (mshtml.HTMLInputElement ele in doc.getElementsByName("H_YOMI_GUN")) //item(index: ) では指定できず…(謎 | |
{ | |
if (ele.value == "3") { ele.click(); } //valueの値を見て選択 | |
} | |
//2つ目の方法 | |
foreach (mshtml.HTMLInputElement ele in doc.getElementsByName("H_RYAKU")) | |
{ | |
if (ele.value == "2") { ele.setAttribute("checked","checked"); } //valueの値を見て選択 (方法その2) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment