;#Region ;**** Directives created by AutoIt3Wrapper_GUI **** ;#AutoIt3Wrapper_Version=Beta ;;#AutoIt3Wrapper_UseX64=n ;#AutoIt3Wrapper_UseX64=Y ;Should be used for stuff like tagpoint having right struct etc. when running on a 64 bits os ;#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;#AutoIt3Wrapper_Run_Debug_Mode=Y ;*************************************************************************************************************************** ;*****************SCRIPT TEMPLATE FOR CREATING NEW SCRIPTS USING WEBDRIVER, ETC.*******************************************8 ;***************************************************************************************************************************** GLOBAL $oExcel Global $ticker ;Global $oIEPGP ;UI Stuff: global $frmSimpleSpy, $edtCtrlInfo , $lblCapture, $lblEscape, $lblRecord, $edtCtrlRecord, $msg, $x, $y, $oUIElement, $oTW, $objParent, $oldElement, $text1, $t #include #include #include ;#include #include #include #Include #include #include #include #include #include ;From UI Examples, may not need all #include #include #include #include #include #include "UIAWrappers.au3" #include ;#include <_Dbug.au3> #include ;***** WebDriver Settup **************************************************************** #include "wd_core.au3" #include "wd_helper.au3" ;************************************************************************************* ;SET LOCATION FOR FILE PATH LOCATIONS: Global $Location $Location = 1 ;2 = Henderson, 1 = Prescott ;************************************************************************************* Local $GKPath[3] $GKPath[1] = "H:\main\A TRADING 2023\SCRIPTS DEV\geckodriver.exe" $GKPath[2] = "H:\Google Drive Folder\main\A TRADING 2023\SCRIPTS DEV\geckodriver.exe" Global $sDesiredCapabilities, $sSession, $sScriptName = "TradeScript" Global $zacksURL $_WD_DEBUG = 1 ; Set debug level: $_WD_DEBUG_None (0) = No logging to console, $_WD_DEBUG_Error (1) = Error logging to console, $_WD_DEBUG_Info (2) = Full logging to console (Default) ;This is 32B driver (copied from working demo, for example) Global $sDriver = $GKPath[$Location] ; <== Please modify this statement to your environment. Must be a local drive, network drives don't work! ; Setup Firefox _WD_Option("Driver", $sDriver) ;If @error Then Exit SetError(1, @error) _WD_Option('DriverParams', '--binary "C:\Program Files\Mozilla Firefox\firefox.exe" --log trace ') _WD_Option('Port', 4444) _WD_Option('DriverClose', False) $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true,"setWindowRect":true}}' ;THIS IS A SCRATCH COMMENT AREA FOR COPYING INFO FOR EDITING SCRIPT ;/html/body/div[8]/div/div[1]/div[1] LR corner popup in Zacks ;/html/body/div[8]/div/div[1] Another Zacks popup ;***** WebDriver Settup Finish **************************************************************** _DebugSetup() ;*************************** DBUG OPTIONS******************* ;AutoItSetOption ( "option" [, param] ) ;AutoItSetOption ("TrayIconDebug", 1) ;Opt("TrayIconDebug", 0) ;0=no info, 1=debug line info ;*************************** DEBUG OPTIONS****************** AutoItSetOption("MustDeclareVars", 1) ;AutoItSetOption("WinTitleMatchMode", 2) Opt("WinTitleMatchMode", -2) ;Opt("RunErrorsFatal", 0) ;Added for solving the excel read issue random failure Opt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client ;Opt("GUICoordMode", 2) Opt("GUIResizeMode", 1) Opt("GUIOnEventMode", 1) _UIA_Init() _WD_Startup() ;If @error Then Exit SetError(2, @error) ;CREATE BROWSER SESSION $sSession = _WD_CreateSession($sDesiredCapabilities) ;If @error Then Exit SetError(3, @error) ;Consolewrite( " sSession = " & $sSession & @CRLF) ;******************IF THIS NAVIGATION IS ENABLED, THE "Watchlists" TEXT IS READ CORRECTLY********************************************************* ;NAVIGATING TO THIS SITE AND ACCESSING THE "Watchlists heading" on the site works #cs _WD_Navigate($sSession, "https://finance.yahoo.com/") _WD_LoadWait($sSession) _WD_Window($sSession, "maximize") #ce ;******************************************************************************* ;Trying to attach to an already opened browser site tab - is this possible? ; (I open the Yahoo Finance site with Firefox with ("https://finance.yahoo.com/") and try to attach to it - - - ;Neither the Title or the URL method for WD Attach is sucessful - 8-no match ;_WD_Attach($sSession, "Yahoo Finance","Title" ) _WD_Attach($sSession, "https://finance.yahoo.com/","URL" ) Local $oIdElements ;XPATH of the element for the "Watchlists" heading at the top of this Yahoo Finance Site ;/html/body/div[1]/div/div/div[1]/div/div[1]/div[2]/div[1]/div/div/div/div[1]/div/div/div/div/nav/div/div/div/div[3]/div/nav/ul/li[1]/a ;***************************Access the "Watchlists heading" on top" $oIdElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body/div[1]/div/div/div[1]/div/div[1]/div[2]/div[1]/div/div/div/div[1]/div/div/div/div/nav/div/div/div/div[3]/div/nav/ul/li[1]/a", Default, False) Local $RetText= _WD_ElementAction($sSession, $oIdElements, "Text") MsgBox(0,"RetText = ",$RetText) Exit