Jump to content

AlfredF

Members
  • Posts

    4
  • Joined

  • Last visited

AlfredF's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Hi. Danp2 already gave you the solution, you need to find the correct element path and click on the DIV (<div role="button" class="px-3 d-flex bg-white">). This works: document.querySelector('div[class="px-3 d-flex bg-white"]').click(), meaning that all you need is to put the correct XPath (something like this maybe: //div[@class='px-3 d-flex bg-white']) and make the click. Remember that there are 2 buttons with that same class name, if you need to click on the second one you can use xpath indexing option.
  2. Glad you got something working. It shouldn't be difficult to integrate the example of how to click the extension into your script. Remembering that if you intend to manipulate the website in Chrome, you should be aware that depending on your Windows version, Chrome window needs to have focus (W10 for example) before you try to access the content of the document (ie. website). If you need more help, you should post the errors and a small reproducer, to make it easy to understand what is not working and help you.
  3. Exactly what is written, that you are trying to return from a global scope. Read this to understand more about Function and Return: https://www.autoitscript.com/autoit3/docs/keywords/Func.htm The example code should look like this: #include "CUIAutomation2.au3" Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "$oUIAutomation ERR" & @CRLF ) ConsoleWrite( "$oUIAutomation OK" & @CRLF ) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement( $pDesktop ) $oDesktop = ObjCreateInterface( $pDesktop, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oDesktop ) Then Return ConsoleWrite( "$oDesktop ERR" & @CRLF ) ConsoleWrite( "$oDesktop OK" & @CRLF ) ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition0 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "Chrome_WidgetWin_1", $pCondition0 ) If Not $pCondition0 Then Return ConsoleWrite( "$pCondition0 ERR" & @CRLF ) ConsoleWrite( "$pCondition0 OK" & @CRLF ) Local $pPane1, $oPane1 $oDesktop.FindFirst( $TreeScope_Children, $pCondition0, $pPane1 ) $oPane1 = ObjCreateInterface( $pPane1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oPane1 ) Then Exit ConsoleWrite( "$oPane1 ERR" & @CRLF ) ConsoleWrite( "$oPane1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition1, $pCondition2, $pAndCondition2 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_MenuItemControlTypeId, $pCondition1 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "FireShot - Capture page" & @LF & "Are acces la acest site", $pCondition2 ) $oUIAutomation.CreateAndCondition( $pCondition1, $pCondition2, $pAndCondition2 ) If Not $pAndCondition2 Then Return ConsoleWrite( "$pAndCondition2 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition2 OK" & @CRLF ) Local $pMenuItem1, $oMenuItem1 $oPane1.FindFirst( $TreeScope_Descendants, $pAndCondition2, $pMenuItem1 ) $oMenuItem1 = ObjCreateInterface( $pMenuItem1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oMenuItem1 ) Then Return ConsoleWrite( "$oMenuItem1 ERR" & @CRLF ) ConsoleWrite( "$oMenuItem1 OK" & @CRLF ) ; --- Invoke Pattern (action) Object --- ConsoleWrite( "--- Invoke Pattern (action) Object ---" & @CRLF ) Local $pInvokePattern1, $oInvokePattern1 $oMenuItem1.GetCurrentPattern( $UIA_InvokePatternId, $pInvokePattern1 ) $oInvokePattern1 = ObjCreateInterface( $pInvokePattern1, $sIID_IUIAutomationInvokePattern, $dtagIUIAutomationInvokePattern ) If Not IsObj( $oInvokePattern1 ) Then Return ConsoleWrite( "$oInvokePattern1 ERR" & @CRLF ) ConsoleWrite( "$oInvokePattern1 OK" & @CRLF ) ; --- Invoke Pattern (action) Methods --- ConsoleWrite( "--- Invoke Pattern (action) Methods ---" & @CRLF ) $oInvokePattern1.Invoke() ConsoleWrite( "$oInvokePattern1.Invoke()" & @CRLF ) EndFunc
  4. Hi. Try change this: For: $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "FireShot - Capture page" & @LF & "Are acces la acest site", $pCondition2 )
×
×
  • Create New...