Click on a href link in an already opened browser window

后端 未结 2 1708
陌清茗
陌清茗 2021-01-25 02:57

In the below code I\'m trying to click on the \"About\" link (href) in the www.google.co.in website. This worked on IE11 (Windows 10), but is not working for IE10 (

2条回答
  •  闹比i
    闹比i (楼主)
    2021-01-25 03:32

    Don't know about QTP, but VBScript doesn't have a Like operator.

    This is the usual way to attach to an IE window with a specific title in plain VBScript:

    Set app = CreateObject("Shell.Application")
    For Each wnd In app.Windows
      If wnd.Name = "Internet Explorer" Then
        If InStr(1, wnd.Document.Title, "Google", vbTextCompare) > 0 Then
          Set ie = wnd
          Exit For
        End If
      End If
    Next
    

提交回复
热议问题