Javascript c#-自动填充程序,如何在浏览器中自动填充选择标记?选择框?
我最近想使用Windows程序和c#.net编程来制作自动键入、自动填充浏览器 我可以自动键入文本类型,但无法重新键入“选择标记” 我搜索过,我想我可以使用“setAttribute(“value”,“selectIndexnumber”)” 但是,我工作不好。资源管理器无法感知“更改”状态 所以首先,我使用了IHTMLElement3.FireEvent(“onchange”,null);调用“onchange” 但它也不起作用 其次,我使用SendKeys.Send(“{TAB}”) 但它也不起作用 我如何才能自动填充“选择标签”,而不会出现用户更改选择标签之类的问题 请帮帮我。提前谢谢 下面是我写的代码 私有无效按钮3\u单击(对象发送者,事件参数e) {Javascript c#-自动填充程序,如何在浏览器中自动填充选择标记?选择框?,javascript,c#,html,.net,web,Javascript,C#,Html,.net,Web,我最近想使用Windows程序和c#.net编程来制作自动键入、自动填充浏览器 我可以自动键入文本类型,但无法重新键入“选择标记” 我搜索过,我想我可以使用“setAttribute(“value”,“selectIndexnumber”)” 但是,我工作不好。资源管理器无法感知“更改”状态 所以首先,我使用了IHTMLElement3.FireEvent(“onchange”,null);调用“onchange” 但它也不起作用 其次,我使用SendKeys.Send(“{TAB}”) 但它也
SHDocVw.InternetExplorer browser;
SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindows();
string filename;
MessageBox.Show("shellWindows number is " + shellWindows.Count);
foreach (SHDocVw.InternetExplorer ie in shellWindows)
{
filename = System.IO.Path.GetFileNameWithoutExtension(ie.FullName).ToLower();
if ((filename == "iexplore"))
{
browser = ie;
String myDocURL = browser.Document.url;
MessageBox.Show("this is url" + myDocURL);
if (myDocURL == "https://hankooktire.recruiter.co.kr/app/applicant/modifyResume")
{
IHTMLDocument3 ihtml3doc = (IHTMLDocument3)browser.Document;
IHTMLElement3 ihtml3ele = ihtml3doc.getElementById("jobnoticeSn") as IHTMLElement3;
IHTMLElement ihtmlele = ihtml3doc.getElementById("jobnoticeSn");
ihtmlele.setAttribute("value", "4");
IHTMLSelectElement selEle = ihtml3ele as IHTMLSelectElement;
//selEle.selectedIndex=4;
SendKeys.Send("{TAB}");
ihtml3ele.FireEvent("onchange", null);
//SendKeys.Send("{TAB}");
ihtml3doc.getElementById("jobnoticeSn").children(4).setAttribute("selected", "true");
SendKeys.Send("{TAB}");
//ihtml3doc.getElementById("jobnoticeSn").children(4).setAttribute("checked", "true");
//ihtml3doc.getElementById("jobnoticeSn").children(4).setAttribute("selectedIndex", "true");
//ihtml3doc.getElementById("jobnoticeSn").setAttribute("selected", "selected");
//ihtml3doc.getElementById("jobnoticeSn").setAttribute("value", "8130");
ihtml3doc.getElementById("name").setAttribute("value", "김준혁");
ihtml3doc.getElementById("birthday").setAttribute("value", "1989-11-18");
ihtml3doc.getElementById("man").setAttribute("checked", "true");
ihtml3doc.getElementById("email").setAttribute("value", "jjunest@gmail.com");
ihtml3doc.getElementById("password").setAttribute("value", "emfla248248");
//ihtml3doc.getElementById("password").scrollIntoView();
}
}
}
}
“但是我不能重新键入“选择标签”是什么意思?我想你需要在
select
标签中设置所需的选项
元素的值。对于LeiYang。我可以用值自动填充标签,它看起来像是实际单击的。但是当我单击浏览器上的“提交”按钮时,会说“标签没有任何值”!并且我无法在浏览器中提交表单。我想这是因为没有调用“onchage”状态。哦!我检查了此引用,但它不起作用!我如何解决此问题…(1)使用http post而不是webbrowser如何?