Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21394

JavaScript execution via VB

$
0
0
Hi All,
Please need your kind assistance here with a code

I am trying to automate the way we send bulk/free sms using way2sms.com. Basically I have coded a VB form with a webbrowser and I

I am reached a point where I am able to login. But i am struck here as I need to click a button "Send Free SMS" which is a javascript button click event. I have put the page source below,

wb.Navigate("http://site23.way2sms.com/content/index.html")
While wb.ReadyState <> WebBrowserReadyState.Complete
Application.DoEvents()
End While

wb.Document.GetElementById("username").SetAttribute("value", "Mobile-number")
wb.Document.GetElementById("password").SetAttribute("value", "password")
wb.Document.GetElementById("loginBTN").InvokeMember("click")

Dim doc As mshtml.IHTMLDocument2 = wb.Document.DomDocument

htmlDoc = wb.Document.DomDocument

htmlColl = htmlDoc.getElementsByTagName("input")
wb.Document.InvokeScript("javascript:goToMain('s');") /// its not invoking the script. I have tried multiple things none working for me. Please assist

tried
wb.Navigate(New Uri("javascript:(function(){ javascript:goToMain('s'; })();"))/// this also dint work

For Each htmlInput In htmlColl
If htmlInput.onclick = "function onclick()" & Chr(10) & "{" & Chr(10) & "javascript:goToMain('s');" & Chr(10) & "}" Then //this also dfint work
'htmlInput.FireEvent("onclick")
end if

Next





The way "Send Free SMS" java class is declared is shown below
----------------------------------------------------------------------------------




<div class="lans">
<div class="lan sms">
<h3>Send SMS</h3>
<p>Send Free SMS to any mobile number in India. More than 90% of messages are delivered under 10 seconds.</p>
<input type="button" onclick="javascript:goToMain('s');" class="button br3" value="Send Free SMS" />
</div>

Viewing all articles
Browse latest Browse all 21394

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>