I need help with the following codes:
Dim IE
Dim UserName
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "http://www.nextview.com/index.php?country=my"
Do Until IE.ReadyState <> 3
Loop
Set UserName = IE.Document.getElementById("username") <----- ERROR
IE.Document.all.UserName.Value = "TESTING"
Set Login = IE.Document.getElementById("frmlogin")
Login.submit
Do Until IE.ReadyState <> 3
Loop
The codes are created to help me key in my username. But it has error at the location shown above.
Any idea how to solve this problem?
I think your waiting Do..Loop is not correct.
'Syntax notes:
Do Until [expression return False]
Do While [expression return True]
'So, you can use one of the next:
Do Until IE.readyState = 4
Wscript.Sleep 100
Loop
Do While IE.readyState <> 4
Wscript.Sleep 100
Loop
Related
I'm trying to set my script to sleep until a class is available in a website.
Set IE = createobject("internetexplorer.application")
strURL = "SomeUrl"
If IsNull(IE.Document.GetElementsByClassName("button")) Then
IE.navigate strURL
Do While (IE.Busy Or IE.ReadyState <> 4)
WScript.Sleep 100
Loop
End If
I've looked the error and it does not specify what is wrong so I have no idea.
"Unspecified Error" Code 80004005 at:
If IsNull(IE.Document.GetElementsByClassName("button")) Then
I've also tried:
Set Button = IE.Document.GetElementsByClassName("button")
If IsNull(Button) Then
IE.navigate strURL
Do While (IE.Busy Or IE.ReadyState <> 4)
WScript.Sleep 100
Loop
Set Button = IE.Document.GetElementsByClassName("buttonp")
End If
Same error. What's the problem?
Below is the code block i used to open a new window. I tried using GetObject in place of Create Object as below. But did not work.
Set IE = GetObject("","InternetExplorer.Application")
'
Dim IE
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate "https://msn.com"
Do While IE.ReadyState <> 4
WScript.Sleep 1000
Loop
Set ElementCol = IE.Document.getElementsByTagName("a")
For Each Link In ElementCol
If Link.innerHTML = "News" Then
Link.Click
WScript.Sleep(6000)
Exit For
End If
Next
IE.navigate "https://msn.com"
This uses Explorer which used to do the internet.
Set objShell = CreateObject("Shell.Application")
Do
Set AllWindows = objShell.Windows
Count = 0
For Each window in AllWindows
msgbox window.locationname
' window.refresh2 3
Count = Count + 1
Next
If Count = 0 then Exit Do
Wscript.sleep 5000
Loop
I want to capture just selected elements "Raid Boss Status", but I want capture just the raid boss that I say the name for. Example: I want to capture in this site just: Baium, Antharas and Valakas.
I want to capture just that Boss and save it in a new HTML or text file, and if possible I want separate Deads and Alives, and show the importants boss when Lives sending one warning to me see. When one importante boss respawn send to me one alert.
I had the login working.
WScript.Quit Main
Function Main
Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Visible = True
IE.Navigate "http://zionweb.l2cr.com/gamecpc6/index.php"
'IE.top = 0
'IE.left = 1370
'IE.Height = 770
'IE.Width = 650
Wait IE
With IE.Document
IE.Document.getElementsByName("username")(0).value = "CHECKBOSS"
IE.Document.getElementsByName("password")(0).value = "123456"
IE.Document.forms(0).submit
End With
End Function
Sub Wait(IE)
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
End Sub
Sub IE_OnQuit
On Error Resume Next
WScript.StdErr.WriteLine "IE closed before script finished."
WScript.Quit
End Sub
I've got the vbscript below which needs to send a GET request and then logoff the current user. The idea is to replace the default "logoff" start menu item with this script.
When I run it with cscript it throws an error on line 9,
HTTPGet = IE.document.documentelement.outerhtml
I don't understand what's wrong. Maybe I should wait to receive the response before logging off the user, but as the line above doesn't seem to work I logoff immediately.
TOKEN = "xxxxx"
Set IE = CreateObject("InternetExplorer.Application")
IE.visible = 0
IE.navigate "https://something.com/?action=create&token=" & TOKEN
Do While IE.Busy
WScript.Sleep 200 ' see the above notice of change
Exit Do ' prevents script host from going crazy waiting for IE
loop
HTTPGet = IE.document.documentelement.outerhtml
IE.quit
Set IE = Nothing
'WScript.Echo HTTPGet 'good for debugging. shows what you got back.
Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "C:\WINDOWS\system32\shutdown.exe -l"
If it matters this is for Windows XP only with IE 8.
Try out this code:
Set IE = CreateObject("InternetExplorer.Application")
IE.visible = 0
IE.navigate "https://host/?a=" & TOKEN
i = 1
Do While (IE.readyState <> 4)
WScript.Sleep 1000 ' see the above notice of change
i = i + 1
If (i > 10) Then
Exit Do
End If
loop
HTTPGet = IE.document.documentElement.outerHTML
IE.Quit()
Set IE = Nothing
I found this script online, I edited most of it.
It is able to enter username, and password on its down but it is not able to click login.
please help me fix
Here is login forum.
http://desistream.tv/en/index.shtml
Here is Script currently it is in IE but I will need to change it open in Google Chrome.
WScript.Quit Main
Function Main
Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Visible = True
IE.Navigate "http://desistream.tv/en/index.shtml"
Wait IE
With IE.Document
.getElementByID("login_username").value = "myusername"
.getElementByID("login_password").value = "mypassword"
.getElementByID("form").submit
End With
End Function
Sub Wait(IE)
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
End Sub
Sub IE_OnQuit
On Error Resume Next
WScript.StdErr.WriteLine "IE closed before script finished."
WScript.Quit
End Sub
Here is...
Call Main
Function Main
Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Visible = True
IE.Navigate "http://desistream.tv/en/index.shtml"
Wait IE
With IE.Document
.getElementByID("username").value = "myusername"
.getElementByID("pass").value = "mypassword"
.getElementsByName("frmLogin")(0).Submit
End With
End Function
Sub Wait(IE)
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
End Sub
If you look at the page source, you'll see that the actual <form> tag is called frmLogin, not login.