jasonmarsh
Programmer
Hello... new to the forum here.
I have a abscure question that you probably don't run across every day.
I'm currently working on an object that will automatin web-based applications using the mshtml object. I can send text to input fields, I can click buttons, select hyperlinks, and various other actions.
However, I'm a little stumped with regard to a form list box. I am wanting to find all options within the list box. So, given an list box named DPF0, I want to return an array list of all the items within it (for only that control). I thought I would need to do this similar to how I loop through all the anchor on the page to get the hyperlinks. This may still be the correct option but the mshtml object is so vast and undocumented I am at a lost.
Here is what I am trying
ArrayList TempList = new ArrayList();
IHTMLElementCollection ListItems =(IHTMLElementCollection) Doc.getElementsByTagName("option");
foreach (HTMLOListElementClass ListItem in ListItems)
{
TempList.Add(ListItem.innerText);
}
This isn't working because of an invalid cast type on the HTMLOListElementClass.
Also this wouldn't work because it would return all option tag items, not just those specific to that DPF0 control.
Any help on this would be greatly appreciated. Also, if you have any help on selecting the item from the list box control, I could use that too.
Thank you in advance ~ Jason
I have a abscure question that you probably don't run across every day.
I'm currently working on an object that will automatin web-based applications using the mshtml object. I can send text to input fields, I can click buttons, select hyperlinks, and various other actions.
However, I'm a little stumped with regard to a form list box. I am wanting to find all options within the list box. So, given an list box named DPF0, I want to return an array list of all the items within it (for only that control). I thought I would need to do this similar to how I loop through all the anchor on the page to get the hyperlinks. This may still be the correct option but the mshtml object is so vast and undocumented I am at a lost.
Here is what I am trying
ArrayList TempList = new ArrayList();
IHTMLElementCollection ListItems =(IHTMLElementCollection) Doc.getElementsByTagName("option");
foreach (HTMLOListElementClass ListItem in ListItems)
{
TempList.Add(ListItem.innerText);
}
This isn't working because of an invalid cast type on the HTMLOListElementClass.
Also this wouldn't work because it would return all option tag items, not just those specific to that DPF0 control.
Any help on this would be greatly appreciated. Also, if you have any help on selecting the item from the list box control, I could use that too.
Thank you in advance ~ Jason