0

Hey all i have the following html code on a web page that i am trying to send a click event to; it's a SELECT tag. However, i am unable to find it using the following code:

Dim element As HtmlElement = bbsmWB.Document.GetElementsByTagName("SELECT").Cast(Of HtmlElement).First(Function(el) el.GetAttribute("id") = "aPopUp")

element.GetElementsByTagName("OPTION").Cast(Of HtmlElement).First(Function(el) el.InnerText = "thunder").SetAttribute("selected", "selected")

It seems to be due to the fact that the Select tag that i am looking for is within an iframe of that web page.

I am able to get the HTML just fine doing this:

theHTML = bbsmWB.Document.Window.Frames("ifrm-rtw32").Document.Body.InnerHtml

Within the theHTML i found the aPopUp code.

The HTML code looks like this:

<SELECT style="WIDTH: 100%" id=aPopUp onclick=hideMe() size=20>
  <OPTION value=sunny>Sunny</OPTION>
  <OPTION selected value=rain>Rain showers</OPTION>
  <OPTION value=thunder>Thunder Storms</OPTION>
  <OPTION value=snow>Snow Showers</OPTION>
</SELECT>

How can i modify the vb.net code above in order for it to look in the iframe instead of the default page?

4

1 回答 1

0

我觉得只是runat="server"选择答案太容易了。:)

于 2013-07-24T19:19:35.453 回答