Internet explorer 在msgbox中获取网页文本
我试图让一个msgbox出现,一旦我的代码已经发送。 我想显示内部文本 到目前为止我有Internet explorer 在msgbox中获取网页文本,internet-explorer,vbscript,com,messagebox,Internet Explorer,Vbscript,Com,Messagebox,我试图让一个msgbox出现,一旦我的代码已经发送。 我想显示内部文本 到目前为止我有 ie = CreateObject("InternetExplorer.Application") ie.Navigate("http://www.webpage.com.au/") ie.Visible = True mesg = TextBox1.Text.ToString() pw = "....." ie.Document.All("password").Value = pw ie.Doc
ie = CreateObject("InternetExplorer.Application")
ie.Navigate("http://www.webpage.com.au/")
ie.Visible = True
mesg = TextBox1.Text.ToString()
pw = "....." ie.Document.All("password").Value = pw
ie.Document.All("idpagers").Value = Id
ie.Document.All("message").Value = mesg
ie.Document.All("Send").Click()
pID = ie.Document.All().ToString
MessageBox.Show(pID)
但这显示了system.object.blah.blah
把这个放在导航之后。您必须等待页面加载
这会将html文本分配给页面,然后提取纯文本
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = 0
ie.Silent = 1
ie.Navigate2 "file://" & FilterPath & "Filter.html"
Do
wscript.sleep 50
Loop Until ie.document.readystate = "complete"
ie.document.body.innerhtml = Inp.readall
Outp.write ie.document.body.innertext
把这个放在导航之后。您必须等待页面加载
这会将html文本分配给页面,然后提取纯文本
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = 0
ie.Silent = 1
ie.Navigate2 "file://" & FilterPath & "Filter.html"
Do
wscript.sleep 50
Loop Until ie.document.readystate = "complete"
ie.document.body.innerhtml = Inp.readall
Outp.write ie.document.body.innertext
请尝试使用此代码:
Const TriStateTrue = -1 ' Pour la prise en charge de l'Unicode
URL = InputBox("Entrez l'URL pour y extraire son Code Source HTML "&vbcr&vbcr&_
"Exemple ""http://www.google.fr""","Extraction du Code Source © Hackoo © 2013","http://www.google.fr")
If URL = "" Then WScript.Quit
Titre = "Extraction du Code Source de " & URL
Set ie = CreateObject("InternetExplorer.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
ie.Navigate(URL)
ie.Visible=false
DO WHILE ie.busy
LOOP
DataHTML = ie.document.documentElement.innerHTML
strFileHTML = "CodeSourceHTML.txt"
Set objHTMLFile = objFSO.OpenTextFile(strFileHTML, 2, True, TriStateTrue)
objHTMLFile.WriteLine(Titre&vbcrLF&String(120,"*"))
objHTMLFile.WriteLine(DataHTML)
objHTMLFile.Close
ie.Quit
Set ie=Nothing
wscript.echo DataHTML
Ouvrir(strFileHTML)
wscript.Quit
Function Ouvrir(File)
Set ws=CreateObject("wscript.shell")
ws.run "Notepad.exe "& File,1,False
end Function
请尝试使用此代码:
Const TriStateTrue = -1 ' Pour la prise en charge de l'Unicode
URL = InputBox("Entrez l'URL pour y extraire son Code Source HTML "&vbcr&vbcr&_
"Exemple ""http://www.google.fr""","Extraction du Code Source © Hackoo © 2013","http://www.google.fr")
If URL = "" Then WScript.Quit
Titre = "Extraction du Code Source de " & URL
Set ie = CreateObject("InternetExplorer.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
ie.Navigate(URL)
ie.Visible=false
DO WHILE ie.busy
LOOP
DataHTML = ie.document.documentElement.innerHTML
strFileHTML = "CodeSourceHTML.txt"
Set objHTMLFile = objFSO.OpenTextFile(strFileHTML, 2, True, TriStateTrue)
objHTMLFile.WriteLine(Titre&vbcrLF&String(120,"*"))
objHTMLFile.WriteLine(DataHTML)
objHTMLFile.Close
ie.Quit
Set ie=Nothing
wscript.echo DataHTML
Ouvrir(strFileHTML)
wscript.Quit
Function Ouvrir(File)
Set ws=CreateObject("wscript.shell")
ws.run "Notepad.exe "& File,1,False
end Function
Vb脚本很抱歉,我添加了错误的标记问题在于使用了
ToString()
,它只提供了调用对象的字符串表示形式,因此System.object
等。使用InnerHTML()
和innerText()
而是返回DOM元素的HTML表示形式或仅返回文本表示形式。@Lankymart能否请您给出一个示例作为答案,以便我可以标记为已回答(如果正确)。这里已经有两个答案,详细说明了使用InnerText()
和InnerHTML()
,我刚刚指出,ToString()
并没有提供您所期望的。Vb脚本很抱歉,我添加了错误的标记问题在于使用了ToString()
,它只提供了您调用对象的字符串表示形式,因此System.object
等。使用InnerHTML()
和innerText()
而是返回DOM元素的HTML表示形式或仅返回文本表示形式。@Lankymart能否请您给出一个示例作为答案,以便我可以标记为已回答(如果正确)。这里已经有两个答案,详细说明了使用InnerText()
和InnerHTML()
,我只是指出,ToString()
并没有给你你期望的东西。我在我的真实作品中也放了类似的东西,但结果是一样的。我在我的真实作品中也放了类似的东西,但结果是一样的