2014-09-01 3 views
-1

누군가 나를 도울 수 있습니까? 웹 브라우저로 양식을 자동화하고 "보고서"텍스트가 포함 된 단추를 클릭하는 방법을 알아야합니다. 모두 ID를 "보내"있기 때문에 ID로 처리 할 수 ​​없습니다.C# 같은 ID로 html 버튼을 클릭하십시오.

this.form.target=''; 
     this.form.action='/foglioorario.php'; 
     this.form.submit();"><OPTION value='0'></OPTION><OPTION value='1'>Tirana</OPTION></SELECT></td> 
       </tr><tr> 
        <td><input name='azione' value='Importa Curva' type='button' class='TbStyle' onclick="on_click('form1', 'importForecast.php', 'import')"/></td> 
        <td colspan='2'><span style='margin-right:20px'> 
         Alpha:<input name='alpha' id='alpha' type='TEXT' maxlength='3' value='95' style='width:25px'/>% 
         </span> 
         <span style='margin-right:20px'> 
         TMS:<input name='tms' id='tms' type='TEXT' maxlength='3' value='290' style='width:25px'/> 
         </span>     
         <span>     
         <input type='submit' id='send' name='send' value='Compara curva' class='TbStyle'/> 
         </span> 
         <span> 
         <input type='submit' id='send' name='send' value='Export CC' class='TbStyle' title='Click per export Excel'/> 
         </span> 
        </td> 
        <td><input type='submit' id='send' name='send' value='Report' class='TbStyle'/> 
        <input type='submit' id='send' name='send' value='Export R' class='TbStyle' title='Click per export Excel'/></td> 
        <td><input type='submit' id='send' name='send' value='Riepilogo Sett' class='TbStyle'/> 
        <input type='submit' id='send' name='send' value='Export S' class='TbStyle' title='Click per export Excel'/></td> 
        <td> 
         <span>Pause: <input type='checkbox' name='chkpause' /></span> 
         <span style='padding-left:10px'>Disp.Strao: <input type='checkbox' name='chkStrao' /></span> 

       </tr> 
+0

을 당신이 무엇인지 설명 개 pls 수있는 샘플에 자바 스크립트와 HTML의 이상한 혼합이 : 이 그것을 사용하는 방법 메신저입니까? – Dalorzo

답변

1

당신이 말하는 것을 얻은 것 같아요, 이것이 당신에게 도움이되는지 알려주세요.

IHTMLElementCollection buttonCol = doc.getElementsByTagName("input"); 
foreach (IHTMLElement btn in buttonCol) 
{ 
    if (btn.getAttribute("value") == "Report") 
    { 
     btn.click(); 
     break; 
    } 
} 
0

답변이 저를 저장했습니다. 방금 수정했으며 mshtml없이 사용했습니다.

 WebBrowser wb = webBrowser1; 
     var doc = wb.Document; 
     HtmlElementCollection el = doc.GetElementsByTagName("input"); 
     foreach (HtmlElement btn in el) 
     { 
      if (btn.GetAttribute("value") == "Report") 
      { 
       btn.InvokeMember("click"); 
       break; 
      } 
     } 

u're 큰 thnx

관련 문제