html - VB WebBrowser control dropdownlist -


on webpage: https://www.youtube.com/upload_defaults want control dropdown category.

when inspect element don't find id can't use getelementbyid.

i have tried code doesn't work:

dim allelements htmlelementcollection = webbrowser1.document.all  each webpageelement htmlelement in allelements      if webpageelement.getattribute("value") = "category_id"         webpageelement.setattribute("value", "20")      end if 

thanks in advance.

after inspecting element, you're right, category dropdown not have id, has name: category_id. condition check if current looped htmlelement category dropdown, wrong. replace line:

 if webpageelement.getattribute("value") = "category_id" 

with this:

if webpageelement.getattribute("name") = "category_id" 

or this:

if instr(webpageelement.name, "category_id") 

because, don't forget, category_id dropdown's name.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -