Jump to content

IUIAutomation MS framework automate chrome, FF, IE, ....


junkew
 Share

Recommended Posts

  • 2 weeks later...
  • 2 weeks later...

I have just a couple of _UIA_actions, some simple clicks. There is about 5 seconds between clicks. I'd like to speed this up, if possible.

First, how do I turn off logging, to see if that helps?

Second, any other ideas for speeding things up?

Link to comment
Share on other sites

Func _UIA_LoadConfiguration()

    _UIA_setVar("RTI.ACTIONCOUNT", 0)

;~  Some settings to use as a default
    _UIA_setVar("Global.Debug", True)
    _UIA_setVar("Global.Debug.File", True)
    _UIA_setVar("Global.Highlight", True)

;~  Check if we can find a configuration file and load it from that file
    If FileExists($UIA_CFGFileName) Then
        _UIA_loadCFGFile($UIA_CFGFileName)
    EndIf
;~      _UIA_LOG("Script name " & stringinstr(@scriptname),  $UIA_Log_Wrapper)
EndFunc   ;==>_UIA_LoadConfiguration

So put these at False. I believe there is a bug that logfile is allways created 

    _UIA_setVar("Global.Debug", False)
    _UIA_setVar("Global.Debug.File", False)
    _UIA_setVar("Global.Highlight", True)

Speed is for me less relevant (although I do not observe 5 seconds delay) as it runs unattended or in virtual box.

I you read on IUIAutomation you could do caching but buying quicker PC is probably cheaper

You could lower this value

Global $UIA_DefaultWaitTime = 200 ;Frequently it makes sense to have a small waiting time to have windows rebuild, could be set to 0 if good synch is happening

 

Link to comment
Share on other sites

I stopped the automated logging by making line 560 as a comment (typing a ";" at its start) in the file UIAWrappers.au3 (the line reads  _UIA_LogFile(@YEAR & @MON & @MDAY & "-" & @HOUR & @MIN & @SEC & @MSEC & ".XML" , true)” . This did not cause any adverse effect.

Link to comment
Share on other sites

There is a minor bug in _UIA_normalizeExpression() when passing index, indexrelative, or instance.

$index = _UIA_getPropertyIndex($propName) ; index/indexrelative/instance return -1
If $index >=0 Then
[...]
Else
    $asProperties2Match[$i][0] = $propName
    $bSkip=true ; **** Otherwise _UIA_getObjectByFindAll will try to match by property value, which is not desired.
EndIf

I am using the 5.1 zip. Thanks for this wrapper.

-a

Link to comment
Share on other sites

  • 4 weeks later...

@junkew

Is there a way to get element by HTML id?

In the page:

<input name="usuario" type="text" class="input" id="usuario" value="" maxlength="13" vk_15056="subscribed">

For getting this in focus, i'm actually using:

Local $oUIElement=_UIA_getObjectByFindAll($oP3, "Title:=Login;controltype:=UIA_EditControlTypeId", $treescope_subtree)
_UIA_action($oUIElement,"setvalue using keys", "usuario")

Thanks adv.

Link to comment
Share on other sites

On 02/03/2016 at 2:17 PM, junkew said:

It depends on what you want. In any browser addressbar you can type javascript to execute actions or analyse dom structure. Thats sometime an efficient way to speak to your browser if you want to control all browsers in same way.

Ohhh, this information is so usefull, thanks!!!

EDIT:

This thing really works!

I'm using:

javascript:{document.getElementById('usuario').focus();}

Thanks!

Edited by Chiitus
Link to comment
Share on other sites

  • 2 weeks later...

I have some troubles with elements with blank title property - functions tend to "find" first available element with same properties (beside the title)

; standart variant from simplespy.au3
;
Local $oP2=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:="&$sSomeTitle_1&";controltype:=UIA_WindowControlTypeId;class:=MozillaWindowClass", $treescope_children)
_UIA_Action($oP2,"setfocus")
Local $oP1=_UIA_getObjectByFindAll($oP2, "Title:="&$sSomeTitle_2&";controltype:=UIA_WindowControlTypeId;class:=MozillaWindowClass", $treescope_children)
_UIA_Action($oP1,"setfocus")
Local $oP0=_UIA_getObjectByFindAll($oP1, "Title:=;controltype:=UIA_ComboBoxControlTypeId;class:=", $treescope_children)
;-----------------------------------------------^

Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=;ControlType:=UIA_EditControlTypeId", $treescope_subtree)
_UIA_action($oUIElement,"setfocus")

 

I'm trying to use previous element, but it not working...

; variant using named previous element
;
Local $oP1=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:="&$sSomeTitle_1&";controltype:=UIA_WindowControlTypeId;class:=MozillaWindowClass", $treescope_children)
_UIA_Action($oP1,"setfocus")
Local $oP0=_UIA_getObjectByFindAll($oP1, "Title:="&$sSomeTitle_2&";controltype:=UIA_WindowControlTypeId;class:=MozillaWindowClass", $treescope_children)
_UIA_Action($oP0,"setfocus")
Local $oP00=_UIA_getObjectByFindAll($oP0, "title:="&$sSomeTitle_3&";ControlType:=UIA_TextControlTypeId", $treescope_children)
_UIA_Action($oP00,"setfocus")
Local $oP000=_UIA_getObjectByFindAll($oP00, "next:=", $treescope_subtree)
;-------------------------------------------------^

_UIA_Action($oP000,"setfocus")
Local $oUIElement=_UIA_getObjectByFindAll($oP000, "ControlType:=UIA_EditControlTypeId", $treescope_subtree)
_UIA_action($oUIElement,"setfocus")

How i should use "next" property correctly to get to next element?

Link to comment
Share on other sites

Hopefully next version I have some time to document more. At least in code all functions are documented in version I have not shared yet

  • next does not exist indexrelative:=[+|-]nn where nn is a number
  • is there description for all "_UIA_"-functions? 
    No, partly in this thread and read function Func _UIA_action($obj_or_string, $strAction, $p1 = 0, $p2 = 0, $p3 = 0, $p4 = 0)

 

Link to comment
Share on other sites

I have found a nice piece of code from the post number #73

 

which can write in console all information about all controls from the specified window in nice tree style. Now after full scan (which takes about 5 seconds for my PC) I have found specified control which I am interested to get title value. How can make it faster to get this value? I noticed that it could be find by check "Title" and "Ctrl Type" values only (because other is blank or 0). When I deleted some code from script (get other values like Class, Ctrl name, Value and Handle) then scan takes about 2 seconds now which is better but not perfect yet. I have also noticed that my value is located in 4th level of tree deep ($iLevel = 4). Is it possible to set the script to look only in that level? Is there any other way to get my value faster? For more info you can also check my other post i have described here

Link to comment
Share on other sites

  • 2 weeks later...

hi! i need some help trying to reading a text with SimpleSpy, :S

I capture this object

PIC1:

https://lh3.googleusercontent.com/-y0kf3sOuijU/Vw1QxbwJu8I/AAAAAAAAOs4/gbTeNK48LfIZf6lh4NISLEgpBGqdrQVbwCCo/s800-Ic42/pantalla1AutoIT.png

And i copy the standart code, but i want read not clic.
 

#include "UIAWrappers.au3"

main()

func main()
    Local $oP8=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Clientes (50542601) - testing@optes (Cablevision S.A.);controltype:=UIA_WindowControlTypeId;class:=WindowsForms10.Window.8.app.0.215472d", $treescope_children)
    _UIA_Action($oP8,"setfocus")
    Local $oP7=_UIA_getObjectByFindAll($oP8, "Title:=;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.215472d", $treescope_children)
    _UIA_Action($oP7,"setfocus")
    Local $oP6=_UIA_getObjectByFindAll($oP7, "Title:=;controltype:=UIA_TabControlTypeId;class:=WindowsForms10.Window.8.app.0.215472d", $treescope_children)
    _UIA_Action($oP6,"setfocus")
    Local $oP5=_UIA_getObjectByFindAll($oP6, "Title:=;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.215472d", $treescope_children)
    _UIA_Action($oP5,"setfocus")
    Local $oP4=_UIA_getObjectByFindAll($oP5, "Title:=;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.215472d", $treescope_children)
    _UIA_Action($oP4,"setfocus")
    Local $oP3=_UIA_getObjectByFindAll($oP4, "Title:=;controltype:=UIA_TabControlTypeId;class:=WindowsForms10.Window.8.app.0.215472d", $treescope_children)
    _UIA_Action($oP3,"setfocus")
    Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.215472d", $treescope_children)
    _UIA_Action($oP2,"setfocus")
    Local $oP1=_UIA_getObjectByFindAll($oP2, "Title:=;controltype:=UIA_TableControlTypeId;class:=WindowsForms10.Window.8.app.0.215472d", $treescope_children)
    _UIA_Action($oP1,"setfocus")
EndFunc

so i do that

local $text = _UIA_GetPropertyValue("Title:=CORPORATIVE_CUSTOMERCUSTOMERCONTRACT row 1;controltype:=UIA_CustomControlTypeId;class:=","UIA_LegacyIAccessibleValue");
    InputBox("",$text)

but it returned me that:

PIC2:

https://lh3.googleusercontent.com/-HTgAuJZ3o90/Vw1QleYahqI/AAAAAAAAOs8/BhF8P-a0FrssbQ1LWTjkI7aUPMej35gkQCCo/s260-Ic42/salidaAutoIT2.PNG

how can i read the propertie of the object? what is the correct way to do it.

i would be very grateful if you could help me   :D:D:D , ,

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...