• Excel控制IE


    ---恢复内容开始---

    1、初始化and连接http网页

    Set ie = CreateObject("InternetExplorer.Application")
    ie.Visible = True
    ie.navigate "http://10.251.68.38:8088/....."
    Do Until ie.Readystate = 4
        DoEvents
    Loop

    2、索引对象

      1.by id/name(getElementById搜索时包揽id、name)
    ie.Document.getElementById("name").Value = "aaa"
       2.by tagName
    For i = 0 To ie.Document.All.Length - 1
        If UCase(ie.Document.All(i).tagName) = "INPUT" Then
            If UCase(ie.Document.All(i).Type) = "IMAGE" Then
                ie.Document.All(i).Click
                Exit For
            End If
        End If
    Next
      3.访问frame内元素
    For k = 0 To ie.Document.frames.Length - 1
        For i = 0 To ie.Document.frames(k).Document.All.Length - 1
            If UCase(ie.Document.frames(k).Document.All(i).tagName) = "A" Then
                ss = ie.Document.frames(k).Document.All(i).href
                If InStr(1, ss, "menuID=201", vbTextCompare) > 0 Then
    '            If ie.Document.frames(k).Document.All(i).href = "../inventory/searchInv.jsp?menuID=201" Then
                    ie.Document.frames(k).Document.All(i).Click
                    Exit For
                End If
            End If
        Next
    Next

    3、读取、修改元素属性

     元素各个属性能直接访问,如

    ie.Document.All(“name”).Value
    
    ie.Document.All(i).scr
    
    ie.Document.All(i).href
  • 相关阅读:
    20220501 08:00:01
    20220508 08:00:01
    20220505 08:00:01
    20220430 08:00:01
    20220509 08:00:01
    20220507 08:00:01
    20220503 08:00:01
    20220506 08:00:01
    substrate学习编写简单pallet的问题记录
    Rust内存Layout
  • 原文地址:https://www.cnblogs.com/lulu147/p/5653736.html
Copyright © 2020-2023  润新知