Javascript 通过调用函数导航到url

Javascript 通过调用函数导航到url,javascript,html,function,vbscript,Javascript,Html,Function,Vbscript,我正致力于自动化我们每天使用VBScript完成的一些web表单填写任务 我可以导航到该站点 Set oIE = CreateObject("InternetExplorer.application") oIE.Visible = True oIE.navigate ("https://domain.com/") 这将带到主页 在主页中,我必须导航到另一个名为“应用”的页面,然后才能将数据填入其中 如果是一个按钮 我可以用这样的东西:-> oIE.Docume

我正致力于自动化我们每天使用VBScript完成的一些web表单填写任务

我可以导航到该站点

Set oIE = CreateObject("InternetExplorer.application")

        oIE.Visible = True
        oIE.navigate ("https://domain.com/")
这将带到主页

在主页中,我必须导航到另一个名为“应用”的页面,然后才能将数据填入其中

如果是一个按钮

我可以用这样的东西:->

oIE.Document.All.Item(“按钮名称”)。单击

然而,我所拥有的只是一个标签

<a class="out" onmouseout="displayhelp('1');this.className='out'" onmouseover="displayhelp('0');this.className='over'" onclick="RMF00201_setVal('newapp');"> Apply </a>
它不起作用

任何建议。 谢谢你的帮助

编写脚本一个月后


谢谢

如果我正确理解了你的问题,你所要做的就是:

function RMF00201_setVal(URL){
   window.location.href = URL;
}
您可以直接在正在处理的页面中使用此功能,也可以在代码中显示的其中一个包含脚本中使用此功能。

尝试以下操作:

Option Explicit

Dim objIE, objShell, objShellWindows
Dim strURL, strWindow, strURLFound, WShell, i

strURL = "https://domain.com/"
strWindow = "Apply"
Set oIE = CreateObject("InternetExplorer.Application")
Set oShell = CreateObject("Shell.Application")
Set oShellWindows = oShell.Windows
Set WShell = CreateObject("WScript.Shell")

strURLFound = False

'To Fix Item Not Found Error
For Each oIE in oShellWindows
next

For i = 0 to oShellWindows.Count - 1
    Set oIE = oShellWindows.Item(i)

On Error Resume Next
  If InStr(Ucase(oShellWindows.Item(i).LocationURL),Ucase(strURL)) Then
     If InStr(UCASE(oShellWindows.Item(i).FullName), "IEXPLORE.EXE") Then
        If Err.Number = 0 Then
           If Instr(oShellWindows.Item(i).document.title,(strWindow)) then

              strURLFound = True

              Exit For
           End If
        End If
     End If
  End If
Next

WShell.AppActivate strWindow

这是我在Internet Explorer中尝试访问特定页面时使用的方法。

它不起作用。我刚刚设法单击了oIE.Document.getElementsByTagName(“a”)。项(0)。单击
function RMF00201_setVal(URL){
   window.location.href = URL;
}
Option Explicit

Dim objIE, objShell, objShellWindows
Dim strURL, strWindow, strURLFound, WShell, i

strURL = "https://domain.com/"
strWindow = "Apply"
Set oIE = CreateObject("InternetExplorer.Application")
Set oShell = CreateObject("Shell.Application")
Set oShellWindows = oShell.Windows
Set WShell = CreateObject("WScript.Shell")

strURLFound = False

'To Fix Item Not Found Error
For Each oIE in oShellWindows
next

For i = 0 to oShellWindows.Count - 1
    Set oIE = oShellWindows.Item(i)

On Error Resume Next
  If InStr(Ucase(oShellWindows.Item(i).LocationURL),Ucase(strURL)) Then
     If InStr(UCASE(oShellWindows.Item(i).FullName), "IEXPLORE.EXE") Then
        If Err.Number = 0 Then
           If Instr(oShellWindows.Item(i).document.title,(strWindow)) then

              strURLFound = True

              Exit For
           End If
        End If
     End If
  End If
Next

WShell.AppActivate strWindow