Change Webpage ComboBox Element...
I would like to change the Season Selector on a Netflix webpage to any of the available seasons via code.
Here is a page to use: http://www.netflix.com/WiMovie/70158329
I can get it to Click the button:
Code:
Web1.Document.getElementByid("selectorButton").Click
But I can't seem to get it to change the Season list to another season.
Re: Change Webpage ComboBox Element...
Testing 1, 2, 3... is this thing on?
Re: Change Webpage ComboBox Element...
Quote:
But I can't seem to get it to change
you must select the item by index
else loop through the items to find the match
Re: Change Webpage ComboBox Element...
Your answer gave me nothing to work with. I know WHAT I need to do, I just don't know HOW to do it.
Re: Change Webpage ComboBox Element...
This should help give you an idea of how to do what you want
Code:
Dim MyURL As String
Private Sub Command1_Click()
MyURL = App.Path & "\Test.html"
WebBrowser1.Navigate MyURL
End Sub
Private Sub Form_Load()
MyURL = "NOTHING"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If InStr(URL, MyURL) > 0 Then
'
' Change the value= argument of the combo box
'
WebBrowser1.Document.All("mycombo").Options(0).Value = ""
WebBrowser1.Document.All("mycombo").Options(1).Value = "Friend"
WebBrowser1.Document.All("mycombo").Options(2).Value = "Movie"
WebBrowser1.Document.All("mycombo").Options(3).Value = "Shopping"
WebBrowser1.Document.All("mycombo").Options(4).Value = "TV"
WebBrowser1.Document.All("mycombo").Options(5).Value = "Golf"
'
' Change the text of the dropdown items of the combo box
'
WebBrowser1.Document.All("mycombo").Options(0).innerText = "**Select One**"
WebBrowser1.Document.All("mycombo").Options(1).innerText = "[Friend's House]"
WebBrowser1.Document.All("mycombo").Options(2).innerText = "[Movie Show]"
WebBrowser1.Document.All("mycombo").Options(3).innerText = "[Shopping]"
WebBrowser1.Document.All("mycombo").Options(4).innerText = "[Watching TV]"
WebBrowser1.Document.All("mycombo").Options(5).innerText = "[Playing Golf]"
'
' Make the 3rd item in the dropdown the current selected item
'
WebBrowser1.Document.All("mycombo").Options(3).Selected = True
End If
End Sub
Below is the HTML that was used in the above example
Test.html
Code:
<html>
<body>
<SCRIPT type=text/javascript>
function menu_goto_footer(menuform)
{
selecteditem = menuform.footer_links.selectedIndex;
varLinks = menuform.footer_links.options[ selecteditem ].value;
varTitle = menuform.footer_links.options[ selecteditem ].title;
if (varLinks.length != 0 && varLinks != varTitle && varLinks != '#')
{
//location.href = varLinks;
window.open(varLinks,'','');
}
else if(varLinks != '#')
{
window.open(varLinks,'','');
}
}
</SCRIPT>
<form>
<SELECT onchange=menu_goto_footer(this.form) name=mycombo>
<option value="">(no prefix)</option>
<option value="home" >[Home]</option>
<option value="school" >[School]</option>
<option value="working" >[working]</option>
<option value="studing" >[Studying]</option>
<option value="playing" >[Playing]</option>
</select>
<form>
</body>
</html>
I didn't use the link you posted because the page data is too long and this one is very small but it should give you the idea of how to do it