;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 ;From UI Examples, may not need all #include #include #include #include #include #include "UIAWrappers.au3" #include #include #include ;#include <_Dbug.au3> #include ;***** WebDriver Settup **************************************************************** #include "wd_core.au3" #include "wd_helper.au3" ;************************************************************************************* ;SET LOCATION FOR FILE PATHs: 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 = 2 ; 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) ;Global $hSplash = SplashTextOn($sScriptName, "Running ZACKs ... please be patient!", Default, 45, 0, 0) ;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}}' ;***** 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 _UIA_Init() HotKeySet("{ESC}","ExitScript") ;HotKeySetEx("{RCLICK}", "TkrToTC2000") ; Right Click mouse hot key for TC tkr capture ;COULD NOT MAKE THIS RIGHT MOUSE CLICK WORK, HotKeySet("^{RIGHT}", "TkrToTC2000") ;TEST SCRIPT FOR COPY OF IP SITE STOCK TICKER HYPERLINKS Global $HndlIPdashbd Global $IP_DashboardSite = "https://investorplace.com/dashboard/" dim $rtnerror _WD_Startup() ;CREATE BROWSER SESSION $sSession = _WD_CreateSession($sDesiredCapabilities) ;If @error Then Exit SetError(3, @error) ;Consolewrite( " sSession = " & $sSession & @CRLF) _WD_LoadWait($sSession) ;NOW CALIBRATE POSITIONING ON LEFT SCREEN _WD_Window($sSession, 'RECT', '{"x":-1280, "y":0, "width":1279, "height":600}') _WD_Window($sSession, 'FULLSCREEN') ;************************************************************ _WD_LoadWait($sSession) _WD_Navigate($sSession, $IP_DashboardSite) ;*********************************************************** _WD_LoadWait($sSession) MsgBox(0,"Status","$IP_Dashboard Loaded - SignIn") While 1 Sleep(500) Wend Func TkrToTC2000() ;Get the element under mouse and access the hyperlink ticker symbol Local $avMousePos Local $TkrElement $avMousePos = MouseGetPos() ToolTip("x = " & $avMousePos[0] & " y = " & $avMousePos[1]) $TkrElement = _WD_GetElementFromPoint($sSession, $avMousePos[0], $avMousePos[1]) ;The above statement is successfully returning the element #cs ;THIS IS THE HTML ELEMENT UNDER THE MOUSE - The mouse is on a hyperlink, with the text "ENPH", a stock symbol ENPH When I copy the "inner html" for this element using Firefox Inspect, it is the stock symbol text (ENPH) which is what I'm wanting to access #ce Local $sTkrSymbol = _WD_ElementAction($sSession, $TkrElement, 'property', 'innerHTML') ConsoleWrite ("TkrSymbol = " & $sTkrSymbol) #cs ;THIS IS THE CONSOLE RESULT, unknown command error. I can't see anything wrong with this statement _WD_Window ==> Success [0] : Parameters: Command=RECT Option={"x":-1280, "y":0, "width":1279, "height":600} __WD_Post ==> Success [0] : HTTP status = 200 _WD_Window ==> Success [0] : Parameters: Command=FULLSCREEN Option=Default _WD_LoadWait ==> Success [0 / 4] : Parameters: Delay=Default Timeout=Default Element=Default DesiredState=complete : ReadyState= complete (Fully loaded) __WD_Post ==> Success [0] : HTTP status = 200 _WD_Navigate ==> Success [0] : Parameters: URL=https://investorplace.com/dashboard/ _WD_LoadWait ==> Success [0 / 4] : Parameters: Delay=Default Timeout=Default Element=Default DesiredState=complete : ReadyState= complete (Fully loaded) __WD_Post ==> Success [0] : HTTP status = 200 _WD_ExecuteScript ==> Success [0] _WD_GetElementFromPoint ==> Success [0 / 0] : Parameters: X=-652 Y=467 __WD_Get ==> Unknown Command [18] : HTTP status = 405 _WD_ElementAction ==> Unknown Command [18] : Parameters: Command=property Option=innerHTML TkrSymbol = #ce EndFunc Func ExitScript() Consolewrite("Got to ExitScript") _WD_DeleteSession($sSession) _WD_Shutdown() Exit EndFunc