1

Please help me with the below IE automation scenario,

I need a vba code to click on a web page label text (Log an Issue) which has been placed inside an iframe, the sample html code is given below,

<iframe name="VF304274040_1502270092884IF_1" title="Browse Categories" id="VF304274040_1502270092884IF_1" src="javascript:"<HTML></HTML>"" frameBorder="0" scrolling="auto" style="background-color: transparent; width: 100%; height: 100%; top: 0px; left: 0px;" allowTransparency="allowtransparency" onload="F(1,304274040).ol()" arviewbordercolor="null">
<head>XXXX
<body>XXXX
<div id XXXX>
.............
<div id XXXX>
......
     <div>
          <div class="categoryTitleLink">
          <label class="cursor bold category_title" id="cat-title IDHAA5V0GQBL2AN3HRTMFOSP0OLB90" level="0" category="true" categoryname="Log+an+Issue" descr="#IDHAA5V0GQBL2AN3HRTMFOSP0OLB90" jQuery15019202206560111384="9">
            ....Text - Log an Issue
</body></head>

I've tried the below vba code to parse through the iframe and it's div class inner texts and found the "Log an Issue" element, but i couldn't trigger it.

VBA code:

doc1 = IE.document.frames(1).Name
For Each div In IE.document.frames(doc1).document.getElementsByTagName("div")
        class_obj = div.innerText
        If class_obj = "Log an Issue" Then ' the text was found by this loop
            div.parentElement.Click ' this doesn't works (nothing happening)
        End If
Next div

Please help!!

Community
  • 1
  • 1
Karthik J
  • 11
  • 3

1 Answers1

0

Try

doc1 = IE.document.frames(1).Name
IE.document.frames(doc1).document.getElementId("cat-title IDHAA5V0GQBL2AN3HRTMFOSP0OLB90").Click

The element has an id so try using it.

QHarr
  • 83,427
  • 12
  • 54
  • 101