VB.NET에서 웹 브라우저 컨트롤을 통해 라디오 버튼을 설정하는 데 문제가 있습니다. 이것이 내가 행동하려는 HTML 코드입니다.
<td align="right">
Afficher statuts :
</td>
<td>
<label for="Company">
<input type="radio" id="Services" value="true" name="requestinfo_0" />
Company
</label>
<label for="Partener">
<input type="radio" id="Workload" value="false" name="requestinfo_0" />
Partener
</label>
<label for="All">
<input type="radio" id="All" value="" name="requestinfo_0" />
All
</label>
검색에서 찾은 솔루션은 이렇게 작동해야하지만 그렇지 않습니다!
WebBrowser1.Document.GetElementById("Workload").SetAttribute("Checked", True)
그러나 "Workload"로 하나 이상의 ID를 가질 수 있지만 다른 이름의 라디오 버튼에 이름을 지정해야한다고 생각합니다. 그러나 그에 따라 코드를 작성하는 방법이나 위치를 알 수 없습니다.
Visual Basic의 Visual Studio 2019에서이 작업을 수행하고 있습니다.
클릭 이벤트를 사용하여 문제를 해결했습니다! 이제 잘 작동합니다!
For Each curElement As HtmlElement In WebBrowser1.Document.GetElementsByTagName("input")
If curElement.GetAttribute("type") = "radio" AndAlso curElement.GetAttribute("id") = "Services" Then
curElement.SetAttribute("checked", "checked")
End If
If curElement.GetAttribute("type") = "radio" AndAlso curElement.GetAttribute("id") = "Radio3" Then
curElement.SetAttribute("checked", "checked")
End If
If curElement.GetAttribute("type") = "radio" AndAlso curElement.GetAttribute("id") = "all" Then
curElement.SetAttribute("checked", "checked")
End If
Next
피트
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다