Jump to content
SkysLastChance

IE Click by ID not working [Solved]

Recommended Posts

SkysLastChance

 

WinActivate("MEDITECH - Internet Explorer")
    Sleep (500)
$oIE = _IEAttach("MEDITECH")
$oDiv1 = _IEGetObjById($oIE, "sysmenu-searchbarbutton")
_IEAction($oDiv1, "click")

I am just trying to click the little magnifying glass, next to the gear button with no luck. I was hoping someone might have an idea why this is not working?

 

HTML3.thumb.PNG.a1ec028d04a47f34be241e1133cec206.PNG

Edited by SkysLastChance

Life's simple. You make choices and you don't look back.

Share this post


Link to post
Share on other sites
SkysLastChance

Thank you for the response. 

No Errors in Scite Panel. 

If I click magnifying glass I get nothing in event viewer. If I click the search box section (highlighted in red on picture.) I get all of these.

I know I could do this with control send enter, but I am trying to get better at html. 

HTML4.thumb.PNG.eb9e0c03838fe99880c260fdea404e3c.PNG


Life's simple. You make choices and you don't look back.

Share this post


Link to post
Share on other sites
Danp2

You could try setting focus to the Span element before clicking it -

_IEAction($oDiv1, "focus")

But I would expect to see some events attached to that element. If not there, then check the parent Div elements.

Share this post


Link to post
Share on other sites
SkysLastChance

Is the one I am on not the parent Div? 


Life's simple. You make choices and you don't look back.

Share this post


Link to post
Share on other sites
Danp2

Yes... it appears that you are correct. I didn't detect that when glancing at your earlier message.

This is probably going to be one of those times when it is difficult to assist you because we can't access the site to see exactly what it's doing. You could try saving the HTML to a file and posting it here as an attachment.

Share this post


Link to post
Share on other sites
junkew

Calling a click actionevent is something else then clicking with the mouse (which can trigger an event on a different element)

_IEAction($oDiv1, "click")

compare with

https://www.autoitscript.com/autoit3/docs/functions/MouseClick.htm

So if you have the element you can calculate x,y / retrieve it with the IE functions and then mouseclick at the calculated location

see an example for mousemove in 

https://www.autoitscript.com/autoit3/docs/libfunctions/_IEPropertyGet.htm

 

  • Like 1

Share this post


Link to post
Share on other sites
Juvigy

For sure you have Frames in this page. I didnt see you getting the correct frame !

Share this post


Link to post
Share on other sites
SkysLastChance

@junkews Thank you for the help. This worked perfectly. 

$oDiv1 = _IEGetObjById($oIE, "sysmenu-searchbarbutton")
   $iScreenX = _IEPropertyGet($oDiv1, "screenx")
   $iScreenY = _IEPropertyGet($oDiv1, "screeny")
   $iWidth = _IEPropertyGet($oDiv1, "width")
   $iHeight = _IEPropertyGet($oDiv1, "height")

   $iMousespeed = 30

   $oMouseCords = MouseMove($iScreenX + $iWidth / 2, $iScreenY + $iHeight / 2, $iMousespeed)
   MouseClick($MOUSE_CLICK_LEFT)

 

  • Like 1

Life's simple. You make choices and you don't look back.

Share this post


Link to post
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

  • Similar Content

    • SkysLastChance
      By SkysLastChance
      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  

       
       

    • SkysLastChance
      By SkysLastChance
      I am trying to type a name in patient summary search box. How should I go about doing this. I am clearly not doing it right. (Attached Picture of HTML code.)
      This is what I have tried. I assume this is not working because it is not a form? 
      WinActivate("MEDITECH - Internet Explorer")       Sleep (500)    $oIE = _IEAttach("MEDITECH")    $oForm = _IEFormGetObjByName($oIE, "systemMenu")    $oText = _IEFormElementGetObjByName($oForm, "sysmenu-searchbarinput") _IEFormElementSetValue($oText, "Hey! This works!")
    • aiter
      By aiter
      Just want to report a warning I get when using IE udf and running from F5 in scite

      -> IE.au3 T3.0-2 Warning from function internal function __IEIsObjType, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)
      When I look at IE.au3 I see a comment that this function has been removed as there are no more fatal errors.
       
    • Burgs
      By Burgs
      Hello,
        I have a website with a Google Map I setup using the Google Map API.  It works and displays just fine.  However to make it useful to me I need to be able to dynamically change the map to display different areas by sending new Latitude and Longitude coordinates.  I am having difficulty making this happen.  Here is my code thus far:
      #include <IE.au3> $oIE3 = _IECreate("http://my_sample_website.html") ;just an example, not an actual site... _IELoadWait($oIE3) $s_word = "lat:" $oInputs = _IETagNameAllGetCollection($oIE3) if @error <> 0 Then MsgBox($MB_SYSTEMMODAL, "ERROR", "Error is: " & @error) EndIf ;@error For $oInput In $oInputs if Number($iPos) == -1 Then $iPos = StringInStr($oInput.innerHTML, String($s_word)) if (Number($iPos) > 0) AND (@error == 0) Then ConsoleWrite("I FOUND IT...! " & String($s_word) & @CRLF) $sHTML = _IEBodyReadHTML($oIE3) $_lat_look = 0 $_lng_look = 0 $_end_look = 0 ;default $_lat_look = StringInStr(String($sHTML), "lat:") if Number($_lat_look) <> 0 Then $_lng_look = StringInStr(String($sHTML), "lng:") if Number($_lng_look) <> 0 Then $_end_look = StringInStr(String($sHTML), "}") if Number($_end_look) <> 0 Then ConsoleWrite("HTML BODY: " & $sHTML & @CRLF) $_old_lat = String(StringMid(String($sHTML), $_lat_look, ($_lng_look - $_lat_look))) $_old_lng = String(StringMid(String($sHTML), $_lng_look, ($_end_look - $_lng_look))) ConsoleWrite("$_old_lat: " & $_old_lat & @CRLF) ConsoleWrite("$_old_lng: " & $_old_lng & @CRLF) $_new_lat = "lat: " & String("-34.397") & ", " $_new_lng = "lng: " & String("150.644") & "}; " ConsoleWrite("...new lat is: " & String($_new_lat) & " new lng is: " & String($_new_lng) & @CRLF) $_LOOK = StringReplace($_old_lat, 1, String($_new_lat)) $_LOOK2 = StringReplace($_old_lng, 1, String($_new_lng)) ConsoleWrite("$_LOOK: " & $_LOOK & "$_LOOK2: " & $_LOOK2 & @CRLF) EndIf ;'$_end_look' NOT "0"... $iPos = -1 EndIf ;'String($s_word)' was found in the collection '$oInputs' EndIf ;'$iPos' is "-1" Next  
        I am having trouble trying to replace the line in the HTML ($sHTML variable in my example) that contains the "lat:" and "lng:" information.  I figure if I can replace that line everything else remains the same, and in theory, the map should cycle to display a map with the new latitude and longitude coordinates...I hope. 
        I have attempted to write the $sHTML to a text document and then use '_IEBodyWriteHTML' to read it back into the webpage HTML however that is not working.  There must be an easier method to accomplish this...what am I missing here...?  Any thoughts greatly appreciated.  Regards.       
    • aiter
      By aiter
      I created a webpage using the IE udf. Great, but then I noticed I cannot do a ctrl-F to find something on the page. 
      If I save the page then bring that page up I can find things of course.
      Its trivial really, but is there way to get the ctrl-F to work when the page is generated without resorting to having to save?
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.