|
-
Apr 1st, 2010, 04:30 AM
#1
Thread Starter
New Member
LOG INTO WEBSITE "www.way2sms.com"
Hello everyone
I need to write a code that opens up internet explorer to www.way2sms.com, logs in with my userid and password, navigates to the "Quick Sms" page, enters text in the field and sends the sms.
Need urgent help.. please
-
Apr 1st, 2010, 04:57 AM
#2
Re: LOG INTO WEBSITE "www.way2sms.com"
Search (http://www.vbforums.com/search.php) for "website login" or "website fill form", there are a lot of examples. This is one of them http://www.vbforums.com/showthread.p...=website+login
-
Apr 1st, 2010, 05:47 AM
#3
Re: LOG INTO WEBSITE "www.way2sms.com"
this is quite a simple one
vb Code:
Set wb = CreateObject("internetexplorer.application") wb.navigate2 "http://wwwf.way2sms.com/content/index.html" wb.Visible = True Do Until wb.readystate = 4 DoEvents Loop Set f = wb.document.Forms(0) f.All("password").Value = "pass" f.All("username").Value = "789894588" f.submit
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Apr 1st, 2010, 05:59 AM
#4
Re: LOG INTO WEBSITE "www.way2sms.com"
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Apr 1st, 2010, 11:50 AM
#5
Thread Starter
New Member
Re: LOG INTO WEBSITE "www.way2sms.com"
 Originally Posted by westconn1
this is quite a simple one
vb Code:
Set wb = CreateObject("internetexplorer.application")
wb.navigate2 "http://wwwf.way2sms.com/content/index.html"
wb.Visible = True
Do Until wb.readystate = 4
DoEvents
Loop
Set f = wb.document.Forms(0)
f.All("password").Value = "pass"
f.All("username").Value = "789894588"
f.submit
thanks so much!
i have successfully logged into the site.
now i just need to "click" on the "quicksms" tab, type the phonenumber to send it to and type the message. click on "send"
and close internet explorer.
can u please help me?? thanks again
-
Apr 1st, 2010, 03:59 PM
#6
Re: LOG INTO WEBSITE "www.way2sms.com"
Like most advertising supported Web pages, webscraping to get access to its services may be against the provider's Terms and Conditions. The site's T&Cs document mentions a number of requirements your program may be violating.
I thought this sort of topic was prohibited in these forums, but a moderator might clarify that.
-
Apr 1st, 2010, 04:30 PM
#7
Re: LOG INTO WEBSITE "www.way2sms.com"
as i am not a member of that site and can not login, i am unable to see any of the pages after the login page
and close internet explorer.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Apr 1st, 2010, 04:52 PM
#8
Thread Starter
New Member
Re: LOG INTO WEBSITE "www.way2sms.com"
msconn.
userid is 9998461800
password is puri332434
my code is
Private Sub Command1_Click()
WebBrowser1.Navigate "http://wwwe.way2sms.com/content/index.html"
Do Until WebBrowser1.ReadyState = 4
DoEvents
Loop
WebBrowser1.Document.loginForm.username.Value = "9998461800"
WebBrowser1.Document.loginForm.password.Value = "puri332434"
Do Until WebBrowser1.ReadyState = 4
DoEvents
Loop
WebBrowser1.Document.loginForm.submit
Do Until WebBrowser1.ReadyState = 4
DoEvents
Loop
End Sub
Private Sub Command2_Click()
WebBrowser1.Document.All.wayquicksms1.Click
Do Until WebBrowser1.ReadyState = 4
DoEvents
Loop
End Sub
Private Sub Command3_Click()
WebBrowser1.Document.rtform.MobNo.Value = "9998461800"
WebBrowser1.Document.rtform.TextArea.Value = "hi"
Do Until WebBrowser1.ReadyState = 4
DoEvents
Loop
WebBrowser1.Document.All.send.Click
End Sub
now i can click on the "quicksms" tab
but cant enter text in the form that loads
i cant find the name of the form that loads
please help
-
Apr 1st, 2010, 05:30 PM
#9
Thread Starter
New Member
Re: LOG INTO WEBSITE "www.way2sms.com"
i even tried sendkeys after the "quicksms" tab has been pressed
but the quicksms opens up a "frame" rather than a form..
can that be the problem.. if so.. how do i tackle it?
-
Apr 1st, 2010, 06:25 PM
#10
Re: LOG INTO WEBSITE "www.way2sms.com"
there are several examples on using frames within a webbrowser (or IE) in this forum, note iframes are a bit different to webpage frames, but both types are includes in the frames collection
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Apr 2nd, 2010, 05:43 AM
#11
Thread Starter
New Member
Re: LOG INTO WEBSITE "www.way2sms.com"
THANKS WESTCONN.. IT WORKED!
NOW JUST ONE FINAL STEP TO GO..
heres the problem..
my code is
Private Sub Form_Load()
WebBrowser1.Navigate "http://wwwe.way2sms.com//content/index.html"
Do Until WebBrowser1.ReadyState = 4
DoEvents
Loop
WebBrowser1.Document.All.username.Value = "9998461800"
WebBrowser1.Document.All.password.Value = "puri332434"
WebBrowser1.Document.loginForm.submit
Do Until WebBrowser1.ReadyState = 4
DoEvents
Loop
End Sub
'now i need to wait so that the login is done and the next page is loaded
Private Sub Command1_Click()
WebBrowser1.Document.All.wayquicksms1.Click
End Sub
'wait for the frame to load, then type and send sms
Private Sub Command2_Click()
WebBrowser1.Document.frames("frame").Document.All("MobNo").Value = "9998461800"
WebBrowser1.Document.frames("frame").Document.All("textArea").Value = "Hello"
Do Until WebBrowser1.ReadyState = 4
DoEvents
Loop
WebBrowser1.Document.frames("frame").Document.All("Send").Click
End Sub
AS YOU CAN SEE, I NEED TO WRITE A CODE BETWEEN THE BUTTON CLICKS WHICH ALLOW ME TO WAIT UNTIL THE NEXT FORM OR FRAME IS LOADED, THEN PERFORM THE NEXT TASK..
i tried this
DO UNTIL WEBBROWSER1.READYSTATE = 4
DO EVENTS
LOOP
but still keeps giving me errors
CAN U WRITE A CODE FOR ME TO WAIT SAY 2 TO 3 SECONS?
THANK YOU
ALMOST RESOLVED
-
Apr 2nd, 2010, 06:25 AM
#12
Re: LOG INTO WEBSITE "www.way2sms.com"
I think you can use the Sleep API if you want.
Example:
Code:
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
MsgBox "Going to sleep for 2 seconds. Are you ready ?"
Sleep 2000
MsgBox "Ok. I am back"
End Sub
...
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Apr 2nd, 2010, 07:04 AM
#13
Re: LOG INTO WEBSITE "www.way2sms.com"
you can try like this to wait for the frame to load
vb Code:
wb.document.All.wayquicksms1.Click Set f = wb.document.frames(0) Do Until f.document.readystate = "complete" DoEvents Loop
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Apr 2nd, 2010, 10:32 AM
#14
Thread Starter
New Member
Re: LOG INTO WEBSITE "www.way2sms.com"
it says "variable not defined and points to f"
-
Apr 2nd, 2010, 10:36 AM
#15
Re: LOG INTO WEBSITE "www.way2sms.com"
So define it. I think it should be Dim f As HTMLDocument
-
Apr 2nd, 2010, 10:39 AM
#16
Thread Starter
New Member
Re: LOG INTO WEBSITE "www.way2sms.com"
i also tried this
Private Sub Command1_Click()
WebBrowser1.Document.All.wayquicksms1.Click
Do Until WebBrowser1.Document.frames("frame").Document.ReadyState = "complete"
DoEvents
Loop
WebBrowser1.Document.frames("frame").Document.All("MobNo").Value = "9998461800"
WebBrowser1.Document.frames("frame").Document.All("textArea").Value = "Hello"
End Sub
but it says "object vaiable or with block variable not set"
-
Apr 2nd, 2010, 10:43 AM
#17
Thread Starter
New Member
Re: LOG INTO WEBSITE "www.way2sms.com"
 Originally Posted by baja_yu
So define it. I think it should be Dim f As HTMLDocument
tried
giving me error 91
"object variable or with block variable not set"
-
Apr 2nd, 2010, 10:56 AM
#18
Re: LOG INTO WEBSITE "www.way2sms.com"
At what line of code? You'll have to be more precise.
-
Apr 2nd, 2010, 11:25 AM
#19
Thread Starter
New Member
Re: LOG INTO WEBSITE "www.way2sms.com"
Code:
Private Sub Command1_Click()
Dim f As HTMLDocument
'WebBrowser1.Document.All.wayquicksms1.Click
WebBrowser1.Document.All.wayquicksms1.Click
Set f = WebBrowser1.Document.frames(0)
Do Until f.Document.ReadyState = "complete"
DoEvents
Loop
WebBrowser1.Document.frames("frame").Document.All("MobNo").Value = "9998461800"
WebBrowser1.Document.frames("frame").Document.All("textArea").Value = "Hello"
End Sub
thats where i'm getting the erroe.
according to the code, it shud click on "quicksms" which it does..
but it should also wait till the frame loads, and write in the texts.. but it gives me the error :-(
-
Apr 2nd, 2010, 03:44 PM
#20
Re: LOG INTO WEBSITE "www.way2sms.com"
are you sure the frame has a name (frame) ?
try
f.Document.All("MobNo").Value = "9998461800"
as f is already an object of the frame element
as far as i can tell f should be an htmwindow2, i use object
Last edited by westconn1; Apr 2nd, 2010 at 03:48 PM.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Apr 3rd, 2010, 12:42 AM
#21
Thread Starter
New Member
Re: LOG INTO WEBSITE "www.way2sms.com"
Code:
Private Sub Command1_Click()
Dim f As Object
WebBrowser1.Document.All.wayquicksms1.Click
Set f = WebBrowser1.Document.frames(0)
Do Until f.Document.ReadyState = "complete"
DoEvents
Loop
f.Document.All("MobNo").Value = "9998461800"
f.Document.All("textArea").Value = "Hello"
End Sub
tried :-(
but still the same error.
object variable or with block variable not set.
god!! i just need the entire process to happen in 1 event instead of 3
why is that too much to ask :-(
i also tried
dim f as htmlwindow2
no luck
-
Apr 3rd, 2010, 01:11 AM
#22
Re: LOG INTO WEBSITE "www.way2sms.com"
vb Code:
wb.navigate2 "http://wwwf.way2sms.com/content/index.html" wb.Visible = True Do Until wb.readystate = 4 DoEvents Loop Set f = wb.document.Forms(0) f.All("password").Value = "puri332434" f.All("username").Value = "9998461800" f.submit Do Until wb.readystate = 4 And Not wb.busy DoEvents Loop 'Do While wb.busy 'DoEvents 'Loop wb.document.All.wayquicksms1.Click Set f = wb.document.frames(0) Do Until f.document.readystate = "complete" 'And Not wb.busy DoEvents Loop f.document.All("MobNo").Value = "9998461800" f.document.All("textArea").Value = "Hello" f.document.All("Send").Click
this almost works for me, problem with pop-upblocker dialog has to be dismissed manually, message was sent
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Apr 3rd, 2010, 11:46 PM
#23
Thread Starter
New Member
Re: LOG INTO WEBSITE "www.way2sms.com"
Code:
wb.navigate2 "http://wwwf.way2sms.com/content/index.html"
wb.Visible = True
Do Until wb.readystate = 4
DoEvents
Loop
Set f = wb.document.Forms(0)
f.All("password").Value = "puri332434"
f.All("username").Value = "9998461800"
f.submit
Do Until wb.readystate = 4 And Not wb.busy
DoEvents
Loop
'Do While wb.busy
'DoEvents
'Loop
wb.document.All.wayquicksms1.Click
Set f = wb.document.frames(0)
Do Until f.document.readystate = "complete" 'And Not wb.busy
DoEvents
Loop
f.document.All("MobNo").Value = "9998461800"
f.document.All("textArea").Value = "Hello"
f.document.All("Send").Click
it says "object doesn't support this property or method"
how come it works for u??
-
Apr 4th, 2010, 09:12 AM
#24
Hyperactive Member
Re: LOG INTO WEBSITE "www.way2sms.com"
Imbakaran, please tell me that in post #8 you did not put your real UserID and Password on a public forum. If you did your account is anybodies on the internet until you change your password. Forums such as this and many others are meant to be found by search engines. That is why you should never put any personal information on one.
Slower than a crippled Vista
More buggy than a fresh XP install
Look! Down the road, some 50 miles behind the drunken snail.
It's Ubuntu!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|