
drr
Members-
Posts
6 -
Joined
-
Last visited
Everything posted by drr
-
Thanks Danp2! This solved the issue 👍
-
Hello, I'm trying to get innerHTML attribute of the element on w3 webpage via chrome. But it comes back empty. What am I doing wrong? Here is example script: #include "wd_core.au3" #include "wd_helper.au3" #include "debug.au3" Local $sSession, $sDesiredCapabilities SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_LoadWait($sSession) _WD_Navigate($sSession, "https://www.w3.org/") _WD_LoadWait($sSession) Sleep (10000) $sEl = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@id='w3c_container']") $html = _WD_ElementAction($sSession, $sEl , 'Attribute', 'innerhtml') MsgBox (0,"",$html) _WD_Shutdown() Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}' EndFunc And the output in Scite: __WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}} __WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"85.0.... _WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"85.0.4183.83","chrome":{"chromedriverVersion":"84.0.4147.30 (48b3e868b4cc0aa7e8149519690b6f6949e110a8-refs/branch-heads/4147@{#310})","userDataDir":"C:\\Users\\User1\\AppData\\Local\\Temp\\scoped_dir20792_1909389831"},"goog:chromeOptions":{"debuggerAddress":"localhost:54985"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:virtualAuthenticators":true},"sessionId":"a99a05f4fc74fc83ef07e96425615ef3"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/a99a05f4fc74fc83ef07e96425615ef3/execute/sync; $sData={"script":"return document.readyState", "args":[]} __WD_Post: StatusCode=200; ResponseText={"value":"complete"}... _WD_ExecuteScript: {"value":"complete"}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/a99a05f4fc74fc83ef07e96425615ef3/url; $sData={"url":"https://www.w3.org/"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_Navigate: {"value":null} __WD_Post: URL=HTTP://127.0.0.1:9515/session/a99a05f4fc74fc83ef07e96425615ef3/execute/sync; $sData={"script":"return document.readyState", "args":[]} __WD_Post: StatusCode=200; ResponseText={"value":"complete"}... _WD_ExecuteScript: {"value":"complete"}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/a99a05f4fc74fc83ef07e96425615ef3/element; $sData={"using":"xpath","value":"//div[@id='w3c_container']"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"a3c19afc-bab9-4627-b4c2-3f51946cc017"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"a3c19afc-bab9-4627-b4c2-3f51946cc017"}} __WD_Get: URL=HTTP://127.0.0.1:9515/session/a99a05f4fc74fc83ef07e96425615ef3/element/a3c19afc-bab9-4627-b4c2-3f51946cc017/attribute/innerhtml __WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":null}... _WD_ElementAction: {"value":null}... Thanks for any directions!
-
ADO.au3 UDF - BETA - Support Topic
drr replied to mLipok's topic in AutoIt Projects and Collaboration
Hi mLipok Did you have a chance to look at the problem? Thanks! -
ADO.au3 UDF - BETA - Support Topic
drr replied to mLipok's topic in AutoIt Projects and Collaboration
Hi, I'm trying to use SSPI authentication with _ADO_Connection_OpenMSSQL function by setting the last parameter to False: _ADO_Connection_OpenMSSQL($oConnection, $sServer, $sDatabase, $sUser, $sPassword, 'AppName', @ComputerName & '_' & 'Program_UID',False) Unfortunately it produces error: "C:\Program Files (x86)\AutoIt3\Include\ADO.au3" (1147) : ==> Variable must be of type "Object".: $oConnection.Properties("Integrated Security").Value = "SSPI" $oConnection.Properties("Integrated Security")^ ERROR Is there anything that I might be doing wrong here? Any help appreciated. -
Thanks, it worked fine!
-
Hi, I've script where the flow is as follows: 1. Window is created with custom title and custom window class name (input by user) 2. Second window is created which asks user for input (creates variable with title of another existing window) Problem: 3. When the OK button (confirming input) is pressed, the window is closed (as planned), but it also closes the other window, which was created first. Here's the code (I've compiled it from various threads in this forum): #include <WinAPI.au3> #include <GUIConstants.au3> #include <GUIListBox.au3> #include <guilistview.au3> #Include <GuiEdit.au3> Global Const $CS_VREDRAW = 1 Global Const $CS_HREDRAW = 2 Global Const $IDI_APPLICATION = 32512 Global Const $WHITE_BRUSH = 0 Global Const $CW_USEDEFAULT = 0x80000000 Global $hMsgHelloWndProc Global $WindowClassName Global $WindowTitle ; Get user input for window and class name Do $WindowClassName = InputBox(Default, 'Enter desired WindowClass name', '') Until $WindowClassName <> '' Or @error ; Create background window $hWndMain = GUICreate("My GUI") GUISetState (@SW_SHOW) ; Creating and registring the class $iRet = MsgHelloReg($WindowClassName, $hMsgHelloWndProc) ; Creating and activating a class example $hWndHello = _WinAPI_CreateWindowEx(0, $WindowClassName, $WindowClassName, _ $WS_OVERLAPPEDWINDOW, $CW_USEDEFAULT, 0, $CW_USEDEFAULT, 0, $hWndMain, 0, _WinAPI_GetModuleHandle(""), 0) $iRet = _WinAPI_ShowWindow($hWndHello) WinWait ($WindowClassName) $var = WinList() #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 633, 500, 193, 115) $List1 = GUICtrlCreateListView("List of Windows ",10, 10, 600, 400) $OKbutton = GUICtrlCreateButton ("OK",500,420,70,70) Dim $list2[$var[0][0] + 1] For $i = 1 To $var[0][0] If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then $list2[$i] = GUICtrlCreateListViewItem($var[$i][0], $List1) GUISetState(@SW_SHOW) EndIf Next $edit1 = GUICtrlCreateEdit('',20,420,400,40) GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") Func IsVisible($handle) If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Okbutton $WindowTitle = _GUICtrlEdit_GetText ($edit1) ;MsgBox (4160, "Information", "Item 2 Text: "&$WindowTitle ) WinClose ("Form1") Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ; script flow continues here (left for later) ; Unregistering the class before exit $iRet = MsgHelloUnReg($WindowClassName, $hMsgHelloWndProc) ; UDF to create and register our class Func MsgHelloReg($sClassName, ByRef $hWndProc) ; selecting icons and cursors (there is many choices) Local $aIcon = DllCall("user32.dll", "hwnd", "LoadIcon", "hwnd", 0, "int", $IDI_APPLICATION) Local $aCursor = DllCall("user32.dll", "hwnd", "LoadCursor", "hwnd", 0, "int", $IDC_ARROW) ; Registering window processing as CallBack-function $hWndProc = DLLCallbackRegister ("MsgHelloWndProc", "int", "hwnd;int;wparam;lparam") ;Creating and initializing class structures Local $tWndClassEx = DllStructCreate("uint cbSize;uint style;ptr lpfnWndProc;int cbClsExtra;int cbWndExtra;hwnd hInstance;hwnd hIcon;hwnd hCursor;hwnd hbrBackground;ptr lpszMenuName;ptr lpszClassName;hwnd hIconSm") Local $tClassName = DllStructCreate("char["& StringLen($sClassName)+1 &"]") DllStructSetData($tClassName, 1, $sClassName) DllStructSetData($tWndClassEx, "cbSize", DllStructGetSize($tWndClassEx) ) DllStructSetData($tWndClassEx, "style", BitOR($CS_VREDRAW, $CS_HREDRAW) ) DllStructSetData($tWndClassEx, "lpfnWndProc", DllCallbackGetPtr($hWndProc)) DllStructSetData($tWndClassEx, "hInstance", _WinAPI_GetModuleHandle("")) DllStructSetData($tWndClassEx, "hIcon", $aIcon[0]) DllStructSetData($tWndClassEx, "hCursor", $aCursor[0]) DllStructSetData($tWndClassEx, "hbrBackground", _WinAPI_GetStockObject($WHITE_BRUSH)) DllStructSetData($tWndClassEx, "lpszClassName", DllStructGetPtr($tClassName)) DllStructSetData($tWndClassEx, "hIconSm", $aIcon[0]) ; Registering process Local $aRet = DllCall("user32.dll", "dword", "RegisterClassExA", "ptr", DllStructGetPtr($tWndClassEx) ) Return $aRet[0] EndFunc ; ==> MsgHelloReg ; UDF to unregister the class (there should not be a copy of the class) Func MsgHelloUnReg($sClassName, ByRef $hWndProc) DllCallbackFree($hWndProc) Local $aRet = DllCall("user32.dll", "int", "UnregisterClassA", "str", $sClassName, "hwnd", _WinAPI_GetModuleHandle("")) Return $aRet[0] EndFunc ; ==> MsgHelloUnReg ; Window processing of our window class Func MsgHelloWndProc($hWnd, $uMsg, $wParam, $lParam) Local $aRet, $iRet, $hDC, $tRect, $sDrawText = "Hello, World!" Switch $uMsg Case $WM_PAINT $stPaint = DllStructCreate("int;int;long;long;long;long;int;int;byte[32]") $ahDC = DllCall("user32.dll", "int", "BeginPaint", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPaint)) $tRect = _WinAPI_GetClientRect($hWnd) _WinAPI_DrawText($ahDC[0], $sDrawText, $tRect, BitOR($DT_SINGLELINE, $DT_CENTER, $DT_VCENTER)) DllCall("user32.dll", "int", "EndPaint", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPaint)) Case $WM_CLOSE _WinAPI_DestroyWindow($hWnd) Case $WM_DESTROY ; $aRet = DllCall("user32.dll", "none", "PostQuitMessage", "int", 0 ) Case Else Return _WinAPI_DefWindowProc($hWnd, $uMsg, $wParam, $lParam) ; Set default window processing EndSwitch Return 0 EndFunc ; ==> MsgHelloWndProc Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) Local $tagNMHDR, $event $tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Select Case $wParam = $List1 Select Case $event = $NM_CLICK Local $tagNMITEMACTIVATE = DllStructCreate("int;int;int;int;int;int;int;int;int", $lParam) $selected = DllStructGetData($tagNMITEMACTIVATE, 4) $selcol = DllStructGetData($tagNMITEMACTIVATE, 5) $seltxt = StringSplit(GUICtrlRead(GUICtrlRead($List1)),'|') GUICtrlSetData($Edit1, $seltxt[1 + $selcol]) EndSelect EndSelect Return $GUI_RUNDEFMSG EndFunc ;==>WM_Notify_EventsoÝ÷ Ø.¦,zØ^¦ºé¢²Ê&{^æ«¢éÝêÞjëh×6While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Okbutton $WindowTitle = _GUICtrlEdit_GetText ($edit1) ;MsgBox (4160, "Information", "Item 2 Text: "&$WindowTitle ) WinClose ("Form1") Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd but cant figure out what exactly is wrong. Whe using 'ExitLoop' instead of 'Exit' it gives 'unhadled win32 exception'. Thanks for help