Jump to content

IE Class Tag Inside of Iframe? [Solved]


Recommended Posts

I was wondering how I read data inside of a iframe. I would like to be able to click something inside a iframe. However, I can't even find the tag. 

The id and name change all the time so I can't use those. 

The code highlighted in blue is what I am trying to click. (second picture)

Here is what I have tried.

$target = ""

$tags = $oIE.document.GetElementsByTagName("div")
For $tag in $tags
$class_value = $tag.GetAttribute("class")
If string($class_value) = "s_92 altstyle s_93 s_94" Then
    $target = $tag
        ConsoleWrite("Tag Found " & $target.outerText&@CRLF)
    ExitLoop

EndIf
Next

 

5b02f0caad9cb_1of2.thumb.PNG.f4f6fdbb83815e064c2768188adf9f02.PNG

 

 

5b02f0d96b43a_2of2.thumb.PNG.77217f6ccde942b72856b4b6d6fe2060.PNG

Edited by SkysLastChance
Insert code

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Link to comment
Share on other sites

So the iframe name keeps changing, so I believe I will have to do it by number.

However, I am not sure how to do that. I ran the example for IEFrameGetCollection and I get this. (Picture)

Frames.PNG.86d4b90245d706dcf25b5d135d3352b6.PNG

How do I find out which number to use? 

 

#include <Excel.au3>
#include <IE.au3>
#include <GUIConstantsEx.au3>

   $oIE = _IEAttach("MEDITECH") ; attaches to 6.1 Meditech



Local $oFrames = _IEFrameGetCollection($oIE)
Local $iNumFrames = @extended
Local $sTxt = $iNumFrames & " frames found" & @CRLF & @CRLF
Local $oFrame = 2
For $i = 0 To ($iNumFrames - 1)
    $oFrame = _IEFrameGetCollection($oIE, 1)
    $sTxt &= _IEPropertyGet($oFrame, "innertext") & @CRLF
Next
MsgBox($MB_SYSTEMMODAL, "Frames Info", $sTxt)

 

 

Edited by SkysLastChance

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Link to comment
Share on other sites

Sorry I was just playing around. I get the same thing with. 

#include <Excel.au3>
#include <IE.au3>
#include <GUIConstantsEx.au3>

$oIE = _IEAttach("MEDITECH") ; attaches to 6.1 Meditech

Local $oFrames = _IEFrameGetCollection($oIE)
Local $iNumFrames = @extended
Local $sTxt = $iNumFrames & " frames found" & @CRLF & @CRLF
Local $oFrame = 0
For $i = 0 To ($iNumFrames - 1)
    $oFrame = _IEFrameGetCollection($oIE, $i)
    $sTxt &= _IEPropertyGet($oFrame, "innertext") & @CRLF
Next
MsgBox($MB_SYSTEMMODAL, "Frames Info", $sTxt)

 

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Link to comment
Share on other sites

I just want to be able to fill this out. The best way i can do it at this point is just using "Send"  which is not ideal.  So I don't know. 

 

Capture.PNG

Edited by SkysLastChance

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Link to comment
Share on other sites

$target = ""

$tags = $oIE.document.GetElementsByTagName("input")
For $tag in $tags
$class_value = $tag.GetAttribute("class")
If string($class_value) = "navitem s_91" Then
    $target = $tag
        ConsoleWrite("Tag Found " & $target.outerText&@CRLF)
    ExitLoop

EndIf
Next

I was able to find the tag using this.  I have never been so excited to see "Tag Found" in my console. 

FInally! I am hoping I will be able to do what I want now.

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Link to comment
Share on other sites

  • 7 months later...
On 5/26/2018 at 5:51 AM, seandisanti said:

You could do it with javascript or jquery too, fairly easily

I've been doing a bit of greasemonkey work and I find Iframes to be a pain.
Could you give an example how to use jquery to access/click a button inside an iframe?
Maybe I've just missed a crucial point.

Thanks
John

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...