Javascript Injection in Chrome with Excel VBA -
i trying inject search criteria or log-in or whatever chrome window using vba. in ie exercise isn't difficult since ie top level object in dom. totally confused using shell function in vba document object model looks @ top access open window. here example code
function sparkroominchrome() dim chromepath string chromepath = """c:\program files (x86)\google\chrome\application\chrome.exe""" shell (chromepath & " -url https://google.com end function function usercredentials() document.getelementsbyclassname("gsfi")[0].value = "cats"; end function
any guidance super appreciated on or insight other similar solutions. thank you.
using selenium vba achieve task.
1) download , install “seleniumwarpper library” latest version -> site: https://code.google.com/p/selenium-vba/
2) open excel - go "tools -> references.." in vba
3) select “seleniumwrapper type library” - in references
4) try below sample code.
public sub search_4_cat() dim selenium new seleniumwrapper.webdriver selenium.start "chrome", "https://www.google.com/", false selenium.open "https://www.google.com/" selenium.type "name=q", "cat" selenium.click "name=btng" 'selenium.stop ' close browser end sub
for more details check: https://code.google.com/p/selenium-vba/
Comments
Post a Comment