Jump to content

WebDriver UDF - Help & Support (III)


Danp2
 Share

Recommended Posts

Hi Danp2,

 

I have another challenge in getting the value of a certain division or element.

I am not able to get value of this one.

 

Code:

SetupChrome()
;~ SetupEdge()
_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)
;~ local $new_session = _WD_Attach($sSession, "IM and Chat | ServiceNow - Google Chrome",Default)
;~ local $element_id = _WD_GetElementById($sSession, '//*[@id="edge_east"]/div[1]/div/div[1]/div[1]/div[1]/div/div[2]/div/div[1]/ul/li/div/div[2]/div')
;~ MsgBox(0,"",$element_id)
;~ Exit
_WD_Navigate($sSession, "https://siemensgamesa.service-now.com")

;~ _WD_Attach($sSession, "xTicket PRD - Work - Microsoft Edge") ;"Login - Genesys Cloud Accounts - Genesys - Google Chrome","Title")
_WD_LoadWait($sSession, 10000)
;_WD_WaitElement($sSession, $sStrategy, $sSelector[, $iDelay = Default[, $iTimeout = Default[, $lVisible = Default[,$lEnabled = Default[, $lReturnElement = Default]]]]])
local $element_id = _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="i0116"]',5000,Default,Default,Default,Default)
If $element_id = 1 Then
   $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="i0116"]') ;//*[@id="email"] ;//*[@id="user_name"]
   ;MsgBox(0,"$sElement",$sElement)
   _WD_ElementAction($sSession, $sElement, 'value', $sEmailAddress)
   $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="idSIButton9"]') ;//*[@id="password"]
   _WD_ElementAction($sSession, $sElement, 'click')
EndIf

local $element_id2 = _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="i0118"]',5000,Default,Default,Default,Default)
If $element_id2 = 1 Then
   $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="i0118"]') ;//*[@id="user_password"]
   _WD_ElementAction($sSession, $sElement, 'value', $sPassword)
   $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="idSIButton9"]')
   _WD_ElementAction($sSession, $sElement, 'click')
EndIf
;_WD_LoadWait($sSession,30000)
;sleep(10000)
MsgBox(0,"Verification","Please Enter Verification ID")
;sleep(20000)
;~ local $new_session = _WD_Attach($sSession, "Home page loading... | ServiceNow - Google Chrome",Default)
;~ local $element_id = _WD_GetElementById($sSession, '//*[@id="edge_east"]/div[1]/div/div[1]/div[1]/div[1]/div/div[2]/div/div[1]/ul/li/div/div[2]/div')
;~ MsgBox(0,"",$element_id)
local $new_session = _WD_Attach($sSession, "IM and Chat | ServiceNow - Google Chrome",Default)
$sElement = _WD_FindElement($new_session, $_WD_LOCATOR_ByXPath, '//*[@id="edge_east"]/div[1]/div/div[1]/div[1]/div[1]/div/div[2]/div/div[1]/ul/li/div/div[2]/div')
local $result = _WD_ElementAction($new_session, $sElement, 'Text')
MsgBox(0,"$result: ",$result)

Output:

__WD_Post: URL=HTTP://127.0.0.1:9515/session//element; $sData={"using":"xpath","value":"//*[@id=\"edge_east\"]/div[1]/div/div[1]/div[1]/div[1]/div/div[2]/div/div[1]/ul/li/div/div[2]/div"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOr...
__WD_Post ==> Invalid session ID: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x00B6E7D3+124883]\n\tOrdinal0 [0x00B6E7B1+124849]\n\tGetHandleVerifier [0x00DB8530+193488]\n\tGetHandleVerifier [0x00DD4B2C+309708]\n\tGetHandleVerifier [0x00DF15F7+427159]\n\tGetHandleVerifier [0x00DEF7A1+419393]\n\tGetHandleVerifier [0x00DEF2F4+418196]\n\tGetHandleVerifier [0x00D9EE04+89252]\n\tGetHandleVerifier [0x00D9F2F6+90518]\n\tGetHandleVerifier [0x00D9F601+91297]\n\tGetHandleVerifier [0x00E931EC+1089676]\n\tGetHandleVerifier [0x00E917C9+1082985]\n\tGetHandleVerifier [0x00E913A3+1081923]\n\tGetHandleVerifier [0x00F8D9FD+2115741]\n\tOrdinal0 [0x00CBB82E+1488942]\n\tOrdinal0 [0x00C55A7D+1071741]\n\tGetHandleVerifier [0x00D9EB9B+88635]\n\tGetHandleVerifier [0x00D9E56E+87054]\n\tGetHandleVerifier [0x00F95D0C+2149292]\n\tBaseThreadInitThunk [0x75BB6359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8964+228]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8934+180]\n"}}
_WD_FindElement: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x00B6E7D3+124883]\n\tOrdinal0 [0x00B6E7B1+124849]\n\tGetHandleVerifier [0x00DB8530+193488]\n\tGetHandleVerifier [0x00DD4B2C+309708]\n\tGetHandleVerifier [0x00DF15F7+427159]\n\tGetHandleVerifier [0x00DEF7A1+419393]\n\tGetHandleVerifier [0x00DEF2F4+418196]\n\tGetHandleVerifier [0x00D9EE04+89252]\n\tGetHandleVerifier [0x00D9F2F6+90518]\n\tGetHandleVerifier [0x00D9F601+91297]\n\tGetHandleVerifier [0x00E931EC+1089676]\n\tGetHandleVerifier [0x00E917C9+1082985]\n\tGetHandleVerifier [0x00E913A3+1081923]\n\tGetHandleVerifier [0x00F8D9FD+2115741]\n\tOrdinal0 [0x00CBB82E+1488942]\n\tOrdinal0 [0x00C55A7D+1071741]\n\tGetHandleVerifier [0x00D9EB9B+88635]\n\tGetHandleVerifier [0x00D9E56E+87054]\n\tGetHandleVerifier [0x00F95D0C+2149292]\n\tBaseThreadInitThunk [0x75BB6359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8964+228]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8934+180]\n"}}
_WD_FindElement ==> Invalid session ID: HTTP status = 404
__WD_Get: URL=HTTP://127.0.0.1:9515/session//element//text
__WD_Get: StatusCode=404; $iResult = 15; $sResponseText={"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOr...
__WD_Get ==> Invalid session ID: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x00B6E7D3+124883]\n\tOrdinal0 [0x00B6E7B1+124849]\n\tGetHandleVerifier [0x00DB8530+193488]\n\tGetHandleVerifier [0x00DD4B2C+309708]\n\tGetHandleVerifier [0x00DF15F7+427159]\n\tGetHandleVerifier [0x00DEF7A1+419393]\n\tGetHandleVerifier [0x00DEF2F4+418196]\n\tGetHandleVerifier [0x00D9EE04+89252]\n\tGetHandleVerifier [0x00D9F2F6+90518]\n\tGetHandleVerifier [0x00D9F601+91297]\n\tGetHandleVerifier [0x00E931EC+1089676]\n\tGetHandleVerifier [0x00E917C9+1082985]\n\tGetHandleVerifier [0x00E913A3+1081923]\n\tGetHandleVerifier [0x00F8D9FD+2115741]\n\tOrdinal0 [0x00CBB82E+1488942]\n\tOrdinal0 [0x00C55A7D+1071741]\n\tGetHandleVerifier [0x00D9EB9B+88635]\n\tGetHandleVerifier [0x00D9E56E+87054]\n\tGetHandleVerifier [0x00F95D0C+2149292]\n\tBaseThreadInitThunk [0x75BB6359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8964+228]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8934+180]\n"}}
_WD_ElementAction: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOr...
_WD_ElementAction ==> Invalid session ID: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x00B6E7D3+124883]\n\tOrdinal0 [0x00B6E7B1+124849]\n\tGetHandleVerifier [0x00DB8530+193488]\n\tGetHandleVerifier [0x00DD4B2C+309708]\n\tGetHandleVerifier [0x00DF15F7+427159]\n\tGetHandleVerifier [0x00DEF7A1+419393]\n\tGetHandleVerifier [0x00DEF2F4+418196]\n\tGetHandleVerifier [0x00D9EE04+89252]\n\tGetHandleVerifier [0x00D9F2F6+90518]\n\tGetHandleVerifier [0x00D9F601+91297]\n\tGetHandleVerifier [0x00E931EC+1089676]\n\tGetHandleVerifier [0x00E917C9+1082985]\n\tGetHandleVerifier [0x00E913A3+1081923]\n\tGetHandleVerifier [0x00F8D9FD+2115741]\n\tOrdinal0 [0x00CBB82E+1488942]\n\tOrdinal0 [0x00C55A7D+1071741]\n\tGetHandleVerifier [0x00D9EB9B+88635]\n\tGetHandleVerifier [0x00D9E56E+87054]\n\tGetHandleVerifier [0x00F95D0C+2149292]\n\tBaseThreadInitThunk [0x75BB6359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8964+228]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8934+180]\n"}}
>Exit code: 0    Time: 235.1

Link to comment
Share on other sites

Hi Danp2,

 

I tried below code right now but still no value is being captured.

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="edge_east"]/div[1]/div/div[1]/div[1]/div[1]/div/div[2]/div/div[1]/ul/li/div/div[2]/div')
local $result = _WD_ElementAction($sSession, $sElement, 'Text')
MsgBox(0,"$result: ",$result)

Output:

>"D:\Backup\Back_up for new Laptop\D\Tools\AutoIT v3.3.14.3\autoit-v3\install\SciTe\..\autoit3.exe" /ErrorStdOut "D:\Automations\Chrome Automation\WebDriver-0.3.0.3\WebDriver-0.3.0.3\Chrome_test_service_now_v2.au3"    
_WD_IsLatestRelease: False
_WD_IsLatestRelease ==> Success
_WDStartup: OS: WIN_10 WIN32_NT 18363 
_WDStartup: AutoIt: 3.3.14.5
_WDStartup: WD.au3: 0.4.0.1 (Update available)
_WDStartup: WinHTTP:    1.6.4.1 (Download latest source at <https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3>)
_WDStartup: Driver: chromedriver.exe
_WDStartup: Params: --log-path="D:\Automations\Chrome Automation\WebDriver-0.3.0.3\WebDriver-0.3.0.3\chrome.log"
_WDStartup: Port:   9515
__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":"90.0....
_WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"90.0.4430.72","chrome":{"chromedriverVersion":"89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389@{#294})","userDataDir":"C:\\Users\\ronald.paggao\\AppData\\Local\\Temp\\scoped_dir424_78033642"},"goog:chromeOptions":{"debuggerAddress":"localhost:49525"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:extension:largeBlob":true,"webauthn:virtualAuthenticators":true},"sessionId":"3d50278b8672723a00f925863fa959a8"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3d50278b8672723a00f925863fa959a8/url; $sData={"url":"https://siemensgamesa.service-now.com"}
__WD_Post: StatusCode=0; ResponseText=WinHTTP request timed out before Webdriver...
__WD_Post ==> Send / Recv error: WinHTTP request timed out before Webdriver
_WD_Navigate: WinHTTP request timed out before Webdriver
_WD_Navigate ==> Send / Recv error: HTTP status = 0
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3d50278b8672723a00f925863fa959a8/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/3d50278b8672723a00f925863fa959a8/element; $sData={"using":"xpath","value":"//*[@id=\"i0116\"]"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\...
__WD_Post ==> No match: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//*[@id=\"i0116\"]\"}\n  (Session info: chrome=90.0.4430.72)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00B6E7D3+124883]\n\tOrdinal0 [0x00B6E7B1+124849]\n\tGetHandleVerifier [0x00DB8688+193832]\n\tGetHandleVerifier [0x00DDC478+340760]\n\tGetHandleVerifier [0x00DFEE42+482530]\n\tGetHandleVerifier [0x00DF16BA+427354]\n\tGetHandleVerifier [0x00DFD6EB+476555]\n\tGetHandleVerifier [0x00DF154B+426987]\n\tGetHandleVerifier [0x00DD4FFD+310941]\n\tGetHandleVerifier [0x00DD5D8E+314414]\n\tGetHandleVerifier [0x00DD5D19+314297]\n\tGetHandleVerifier [0x00E931EC+1089676]\n\tGetHandleVerifier [0x00E917C9+1082985]\n\tGetHandleVerifier [0x00E913A3+1081923]\n\tGetHandleVerifier [0x00F8D9FD+2115741]\n\tOrdinal0 [0x00CBB82E+1488942]\n\tOrdinal0 [0x00C55A7D+1071741]\n\tOrdinal0 [0x00C5559B+1070491]\n\tOrdinal0 [0x00C554B1+1070257]\n\tOrdinal0 [0x00C8FF53+1310547]\n\tBaseThreadInitThunk [0x75BB6359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8964+228]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8934+180]\n"}}
_WD_FindElement: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//*[@id=\"i0116\"]\"}\n  (Session info: chrome=90.0.4430.72)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00B6E7D3+124883]\n\tOrdinal0 [0x00B6E7B1+124849]\n\tGetHandleVerifier [0x00DB8688+193832]\n\tGetHandleVerifier [0x00DDC478+340760]\n\tGetHandleVerifier [0x00DFEE42+482530]\n\tGetHandleVerifier [0x00DF16BA+427354]\n\tGetHandleVerifier [0x00DFD6EB+476555]\n\tGetHandleVerifier [0x00DF154B+426987]\n\tGetHandleVerifier [0x00DD4FFD+310941]\n\tGetHandleVerifier [0x00DD5D8E+314414]\n\tGetHandleVerifier [0x00DD5D19+314297]\n\tGetHandleVerifier [0x00E931EC+1089676]\n\tGetHandleVerifier [0x00E917C9+1082985]\n\tGetHandleVerifier [0x00E913A3+1081923]\n\tGetHandleVerifier [0x00F8D9FD+2115741]\n\tOrdinal0 [0x00CBB82E+1488942]\n\tOrdinal0 [0x00C55A7D+1071741]\n\tOrdinal0 [0x00C5559B+1070491]\n\tOrdinal0 [0x00C554B1+1070257]\n\tOrdinal0 [0x00C8FF53+1310547]\n\tBaseThreadInitThunk [0x75BB6359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8964+228]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8934+180]\n"}}
_WD_FindElement ==> No match: HTTP status = 404
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3d50278b8672723a00f925863fa959a8/element; $sData={"using":"xpath","value":"//*[@id=\"i0116\"]"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\...
__WD_Post ==> No match: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//*[@id=\"i0116\"]\"}\n  (Session info: chrome=90.0.4430.72)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00B6E7D3+124883]\n\tOrdinal0 [0x00B6E7B1+124849]\n\tGetHandleVerifier [0x00DB8688+193832]\n\tGetHandleVerifier [0x00DDC478+340760]\n\tGetHandleVerifier [0x00DFEE42+482530]\n\tGetHandleVerifier [0x00DF16BA+427354]\n\tGetHandleVerifier [0x00DFD6EB+476555]\n\tGetHandleVerifier [0x00DF154B+426987]\n\tGetHandleVerifier [0x00DD4FFD+310941]\n\tGetHandleVerifier [0x00DD5D8E+314414]\n\tGetHandleVerifier [0x00DD5D19+314297]\n\tGetHandleVerifier [0x00E931EC+1089676]\n\tGetHandleVerifier [0x00E917C9+1082985]\n\tGetHandleVerifier [0x00E913A3+1081923]\n\tGetHandleVerifier [0x00F8D9FD+2115741]\n\tOrdinal0 [0x00CBB82E+1488942]\n\tOrdinal0 [0x00C55A7D+1071741]\n\tOrdinal0 [0x00C5559B+1070491]\n\tOrdinal0 [0x00C554B1+1070257]\n\tOrdinal0 [0x00C8FF53+1310547]\n\tBaseThreadInitThunk [0x75BB6359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8964+228]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8934+180]\n"}}
_WD_FindElement: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//*[@id=\"i0116\"]\"}\n  (Session info: chrome=90.0.4430.72)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00B6E7D3+124883]\n\tOrdinal0 [0x00B6E7B1+124849]\n\tGetHandleVerifier [0x00DB8688+193832]\n\tGetHandleVerifier [0x00DDC478+340760]\n\tGetHandleVerifier [0x00DFEE42+482530]\n\tGetHandleVerifier [0x00DF16BA+427354]\n\tGetHandleVerifier [0x00DFD6EB+476555]\n\tGetHandleVerifier [0x00DF154B+426987]\n\tGetHandleVerifier [0x00DD4FFD+310941]\n\tGetHandleVerifier [0x00DD5D8E+314414]\n\tGetHandleVerifier [0x00DD5D19+314297]\n\tGetHandleVerifier [0x00E931EC+1089676]\n\tGetHandleVerifier [0x00E917C9+1082985]\n\tGetHandleVerifier [0x00E913A3+1081923]\n\tGetHandleVerifier [0x00F8D9FD+2115741]\n\tOrdinal0 [0x00CBB82E+1488942]\n\tOrdinal0 [0x00C55A7D+1071741]\n\tOrdinal0 [0x00C5559B+1070491]\n\tOrdinal0 [0x00C554B1+1070257]\n\tOrdinal0 [0x00C8FF53+1310547]\n\tBaseThreadInitThunk [0x75BB6359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8964+228]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8934+180]\n"}}
_WD_FindElement ==> No match: HTTP status = 404
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3d50278b8672723a00f925863fa959a8/element; $sData={"using":"xpath","value":"//*[@id=\"i0116\"]"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\...
__WD_Post ==> No match: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//*[@id=\"i0116\"]\"}\n  (Session info: chrome=90.0.4430.72)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00B6E7D3+124883]\n\tOrdinal0 [0x00B6E7B1+124849]\n\tGetHandleVerifier [0x00DB8688+193832]\n\tGetHandleVerifier [0x00DDC478+340760]\n\tGetHandleVerifier [0x00DFEE42+482530]\n\tGetHandleVerifier [0x00DF16BA+427354]\n\tGetHandleVerifier [0x00DFD6EB+476555]\n\tGetHandleVerifier [0x00DF154B+426987]\n\tGetHandleVerifier [0x00DD4FFD+310941]\n\tGetHandleVerifier [0x00DD5D8E+314414]\n\tGetHandleVerifier [0x00DD5D19+314297]\n\tGetHandleVerifier [0x00E931EC+1089676]\n\tGetHandleVerifier [0x00E917C9+1082985]\n\tGetHandleVerifier [0x00E913A3+1081923]\n\tGetHandleVerifier [0x00F8D9FD+2115741]\n\tOrdinal0 [0x00CBB82E+1488942]\n\tOrdinal0 [0x00C55A7D+1071741]\n\tOrdinal0 [0x00C5559B+1070491]\n\tOrdinal0 [0x00C554B1+1070257]\n\tOrdinal0 [0x00C8FF53+1310547]\n\tBaseThreadInitThunk [0x75BB6359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8964+228]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8934+180]\n"}}
_WD_FindElement: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//*[@id=\"i0116\"]\"}\n  (Session info: chrome=90.0.4430.72)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00B6E7D3+124883]\n\tOrdinal0 [0x00B6E7B1+124849]\n\tGetHandleVerifier [0x00DB8688+193832]\n\tGetHandleVerifier [0x00DDC478+340760]\n\tGetHandleVerifier [0x00DFEE42+482530]\n\tGetHandleVerifier [0x00DF16BA+427354]\n\tGetHandleVerifier [0x00DFD6EB+476555]\n\tGetHandleVerifier [0x00DF154B+426987]\n\tGetHandleVerifier [0x00DD4FFD+310941]\n\tGetHandleVerifier [0x00DD5D8E+314414]\n\tGetHandleVerifier [0x00DD5D19+314297]\n\tGetHandleVerifier [0x00E931EC+1089676]\n\tGetHandleVerifier [0x00E917C9+1082985]\n\tGetHandleVerifier [0x00E913A3+1081923]\n\tGetHandleVerifier [0x00F8D9FD+2115741]\n\tOrdinal0 [0x00CBB82E+1488942]\n\tOrdinal0 [0x00C55A7D+1071741]\n\tOrdinal0 [0x00C5559B+1070491]\n\tOrdinal0 [0x00C554B1+1070257]\n\tOrdinal0 [0x00C8FF53+1310547]\n\tBaseThreadInitThunk [0x75BB6359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8964+228]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8934+180]\n"}}
_WD_FindElement ==> No match: HTTP status = 404
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3d50278b8672723a00f925863fa959a8/element; $sData={"using":"xpath","value":"//*[@id=\"i0116\"]"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\...
__WD_Post ==> No match: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//*[@id=\"i0116\"]\"}\n  (Session info: chrome=90.0.4430.72)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00B6E7D3+124883]\n\tOrdinal0 [0x00B6E7B1+124849]\n\tGetHandleVerifier [0x00DB8688+193832]\n\tGetHandleVerifier [0x00DDC478+340760]\n\tGetHandleVerifier [0x00DFEE42+482530]\n\tGetHandleVerifier [0x00DF16BA+427354]\n\tGetHandleVerifier [0x00DFD6EB+476555]\n\tGetHandleVerifier [0x00DF154B+426987]\n\tGetHandleVerifier [0x00DD4FFD+310941]\n\tGetHandleVerifier [0x00DD5D8E+314414]\n\tGetHandleVerifier [0x00DD5D19+314297]\n\tGetHandleVerifier [0x00E931EC+1089676]\n\tGetHandleVerifier [0x00E917C9+1082985]\n\tGetHandleVerifier [0x00E913A3+1081923]\n\tGetHandleVerifier [0x00F8D9FD+2115741]\n\tOrdinal0 [0x00CBB82E+1488942]\n\tOrdinal0 [0x00C55A7D+1071741]\n\tOrdinal0 [0x00C5559B+1070491]\n\tOrdinal0 [0x00C554B1+1070257]\n\tOrdinal0 [0x00C8FF53+1310547]\n\tBaseThreadInitThunk [0x75BB6359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8964+228]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8934+180]\n"}}
_WD_FindElement: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//*[@id=\"i0116\"]\"}\n  (Session info: chrome=90.0.4430.72)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00B6E7D3+124883]\n\tOrdinal0 [0x00B6E7B1+124849]\n\tGetHandleVerifier [0x00DB8688+193832]\n\tGetHandleVerifier [0x00DDC478+340760]\n\tGetHandleVerifier [0x00DFEE42+482530]\n\tGetHandleVerifier [0x00DF16BA+427354]\n\tGetHandleVerifier [0x00DFD6EB+476555]\n\tGetHandleVerifier [0x00DF154B+426987]\n\tGetHandleVerifier [0x00DD4FFD+310941]\n\tGetHandleVerifier [0x00DD5D8E+314414]\n\tGetHandleVerifier [0x00DD5D19+314297]\n\tGetHandleVerifier [0x00E931EC+1089676]\n\tGetHandleVerifier [0x00E917C9+1082985]\n\tGetHandleVerifier [0x00E913A3+1081923]\n\tGetHandleVerifier [0x00F8D9FD+2115741]\n\tOrdinal0 [0x00CBB82E+1488942]\n\tOrdinal0 [0x00C55A7D+1071741]\n\tOrdinal0 [0x00C5559B+1070491]\n\tOrdinal0 [0x00C554B1+1070257]\n\tOrdinal0 [0x00C8FF53+1310547]\n\tBaseThreadInitThunk [0x75BB6359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8964+228]\n\tRtlGetAppContainerNamedObjectPath [0x77EB8934+180]\n"}}
_WD_FindElement ==> No match: HTTP status = 404
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3d50278b8672723a00f925863fa959a8/element; $sData={"using":"xpath","value":"//*[@id=\"i0116\"]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"72ba82bc-3916-403e-8025-fe329ae58d91"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"72ba82bc-3916-403e-8025-fe329ae58d91"}}
_WD_WaitElement ==> Success
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3d50278b8672723a00f925863fa959a8/element; $sData={"using":"xpath","value":"//*[@id=\"i0116\"]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"72ba82bc-3916-403e-8025-fe329ae58d91"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"72ba82bc-3916-403e-8025-fe329ae58d91"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3d50278b8672723a00f925863fa959a8/element/72ba82bc-3916-403e-8025-fe329ae58d91/value; $sData={"id":"72ba82bc-3916-403e-8025-fe329ae58d91", "text":"SVC_SD_EMILIA@siemensgamesa.com"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_ElementAction: {"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3d50278b8672723a00f925863fa959a8/element; $sData={"using":"xpath","value":"//*[@id=\"idSIButton9\"]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"d38eb676-446b-4890-9ef5-2c906709fac5"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"d38eb676-446b-4890-9ef5-2c906709fac5"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3d50278b8672723a00f925863fa959a8/element/d38eb676-446b-4890-9ef5-2c906709fac5/click; $sData={"id":"d38eb676-446b-4890-9ef5-2c906709fac5"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_ElementAction: {"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3d50278b8672723a00f925863fa959a8/element; $sData={"using":"xpath","value":"//*[@id=\"i0118\"]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"e68038e4-d1e8-4d11-a177-82594bc3d51e"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"e68038e4-d1e8-4d11-a177-82594bc3d51e"}}
_WD_WaitElement ==> Success
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3d50278b8672723a00f925863fa959a8/element; $sData={"using":"xpath","value":"//*[@id=\"i0118\"]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"e68038e4-d1e8-4d11-a177-82594bc3d51e"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"e68038e4-d1e8-4d11-a177-82594bc3d51e"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3d50278b8672723a00f925863fa959a8/element/e68038e4-d1e8-4d11-a177-82594bc3d51e/value; $sData={"id":"e68038e4-d1e8-4d11-a177-82594bc3d51e", "text":"F5#D=|g%UmO;VCY_X!uzcKBu3<"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_ElementAction: {"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3d50278b8672723a00f925863fa959a8/element; $sData={"using":"xpath","value":"//*[@id=\"idSIButton9\"]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"dd704d96-7980-48ad-a6c6-59462ef5de57"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"dd704d96-7980-48ad-a6c6-59462ef5de57"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3d50278b8672723a00f925863fa959a8/element/dd704d96-7980-48ad-a6c6-59462ef5de57/click; $sData={"id":"dd704d96-7980-48ad-a6c6-59462ef5de57"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_ElementAction: {"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3d50278b8672723a00f925863fa959a8/element; $sData={"using":"xpath","value":"//*[@id=\"edge_east\"]/div[1]/div/div[1]/div[1]/div[1]/div/div[2]/div/div[1]/ul/li/div/div[2]/div"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"fba52961-fecb-4e91-ab36-0bb4147744e4"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"fba52961-fecb-4e91-ab36-0bb4147744e4"}}
__WD_Get: URL=HTTP://127.0.0.1:9515/session/3d50278b8672723a00f925863fa959a8/element/fba52961-fecb-4e91-ab36-0bb4147744e4/text
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":""}...
_WD_ElementAction: {"value":""}...
>Exit code: 0    Time: 183.5

 

Link to comment
Share on other sites

Hi Danp2,

 

Yes, The innertext is the one I need to capture. Do you any idea how to do it?

I saw in the console that $iResult = 0. How can I get this result value?

$iResult = 0; 

Thank you.

Edited by TheOne23
add additional details in the previous submitted request.
Link to comment
Share on other sites

Example from this forum:

$sRowText = _WD_ElementAction($sSession, $aElements[$i], "Property", "innerText")

 

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Hi Danp2,

 

I got this just now.

Code: 

local $new_session = _WD_Attach($sSession, 'IM and Chat | ServiceNow',Default)
MsgBox(0,"$new_session: ",$new_session) ; this is able to get the session ID
;local $element_id = _WD_GetElementById($sSession, '//*[@id="edge_east"]/div[1]/div/div[1]/div[1]/div[1]/div/div[2]/div/div[1]/ul/li/div/div[2]/div')
$sElement = _WD_FindElement($new_session, $_WD_LOCATOR_ByXPath, '//*[@id="edge_east"]/div[1]/div/div[1]/div[1]/div[1]/div/div[2]/div/div[1]/ul/li/div/div[2]/div')
local $result = _WD_ElementAction($new_session, $sElement, "Property", "innerText")
MsgBox(0,"$result: ",$result) ; result still is null

Output:

>"D:\Backup\Back_up for new Laptop\D\Tools\AutoIT v3.3.14.3\autoit-v3\install\SciTe\..\autoit3.exe" /ErrorStdOut "D:\Automations\Chrome Automation\WebDriver-0.3.0.3\WebDriver-0.3.0.3\Chrome_test_service_now_v2.au3"    
_WD_IsLatestRelease: False
_WD_IsLatestRelease ==> Success
_WDStartup: OS: WIN_10 WIN32_NT 18363 
_WDStartup: AutoIt: 3.3.14.5
_WDStartup: WD.au3: 0.4.0.1 (Update available)
_WDStartup: WinHTTP:    1.6.4.1 (Download latest source at <https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3>)
_WDStartup: Driver: chromedriver.exe
_WDStartup: Params: --log-path="D:\Automations\Chrome Automation\WebDriver-0.3.0.3\WebDriver-0.3.0.3\chrome.log"
_WDStartup: Port:   9515
__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":"90.0....
_WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"90.0.4430.72","chrome":{"chromedriverVersion":"89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389@{#294})","userDataDir":"C:\\Users\\ronald.paggao\\AppData\\Local\\Temp\\scoped_dir18828_1913324351"},"goog:chromeOptions":{"debuggerAddress":"localhost:59837"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:extension:largeBlob":true,"webauthn:virtualAuthenticators":true},"sessionId":"3fe3faa32251a61759b0257aae10e881"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3fe3faa32251a61759b0257aae10e881/url; $sData={"url":"https://siemensgamesa.service-now.com"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_Navigate: {"value":null}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3fe3faa32251a61759b0257aae10e881/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/3fe3faa32251a61759b0257aae10e881/element; $sData={"using":"xpath","value":"//*[@id=\"i0116\"]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"afe3f291-1773-48ec-9ba6-ec5c90d422d7"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"afe3f291-1773-48ec-9ba6-ec5c90d422d7"}}
_WD_WaitElement ==> Success
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3fe3faa32251a61759b0257aae10e881/element; $sData={"using":"xpath","value":"//*[@id=\"i0116\"]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"afe3f291-1773-48ec-9ba6-ec5c90d422d7"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"afe3f291-1773-48ec-9ba6-ec5c90d422d7"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3fe3faa32251a61759b0257aae10e881/element/afe3f291-1773-48ec-9ba6-ec5c90d422d7/value; $sData={"id":"afe3f291-1773-48ec-9ba6-ec5c90d422d7", "text":"SVC_SD_EMILIA@siemensgamesa.com"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_ElementAction: {"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3fe3faa32251a61759b0257aae10e881/element; $sData={"using":"xpath","value":"//*[@id=\"idSIButton9\"]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"4b1dcce6-f421-4e16-843c-4a44b213062b"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"4b1dcce6-f421-4e16-843c-4a44b213062b"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3fe3faa32251a61759b0257aae10e881/element/4b1dcce6-f421-4e16-843c-4a44b213062b/click; $sData={"id":"4b1dcce6-f421-4e16-843c-4a44b213062b"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_ElementAction: {"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3fe3faa32251a61759b0257aae10e881/element; $sData={"using":"xpath","value":"//*[@id=\"i0118\"]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"67a8d3ab-7492-4d1d-b420-e382a0446c29"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"67a8d3ab-7492-4d1d-b420-e382a0446c29"}}
_WD_WaitElement ==> Success
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3fe3faa32251a61759b0257aae10e881/element; $sData={"using":"xpath","value":"//*[@id=\"i0118\"]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"67a8d3ab-7492-4d1d-b420-e382a0446c29"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"67a8d3ab-7492-4d1d-b420-e382a0446c29"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3fe3faa32251a61759b0257aae10e881/element/67a8d3ab-7492-4d1d-b420-e382a0446c29/value; $sData={"id":"67a8d3ab-7492-4d1d-b420-e382a0446c29", "text":"F5#D=|g%UmO;VCY_X!uzcKBu3<"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_ElementAction: {"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3fe3faa32251a61759b0257aae10e881/element; $sData={"using":"xpath","value":"//*[@id=\"idSIButton9\"]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"130de094-e769-4254-978b-a410f7c8f221"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"130de094-e769-4254-978b-a410f7c8f221"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3fe3faa32251a61759b0257aae10e881/element/130de094-e769-4254-978b-a410f7c8f221/click; $sData={"id":"130de094-e769-4254-978b-a410f7c8f221"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_ElementAction: {"value":null}...
__WD_Get: URL=HTTP://127.0.0.1:9515/session/3fe3faa32251a61759b0257aae10e881/window/handles
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":["CDwindow-632D3A6BC93476CDE6A5484906545BED"]}...
_WD_Window: {"value":["CDwindow-632D3A6BC93476CDE6A5484906545BED"]}...
__WD_Get: URL=HTTP://127.0.0.1:9515/session/3fe3faa32251a61759b0257aae10e881/window
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"CDwindow-632D3A6BC93476CDE6A5484906545BED"}...
_WD_Window: {"value":"CDwindow-632D3A6BC93476CDE6A5484906545BED"}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/3fe3faa32251a61759b0257aae10e881/window; $sData={"handle":"CDwindow-632D3A6BC93476CDE6A5484906545BED"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_Window: {"value":null}...
__WD_Get: URL=HTTP://127.0.0.1:9515/session/3fe3faa32251a61759b0257aae10e881/title
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"IM and Chat | ServiceNow"}...
_WD_Action: {"value":"IM and Chat | ServiceNow"}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/CDwindow-632D3A6BC93476CDE6A5484906545BED/element; $sData={"using":"xpath","value":"//*[@id=\"edge_east\"]/div[1]/div/div[1]/div[1]/div[1]/div/div[2]/div/div[1]/ul/li/div/div[2]/div"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOr...
__WD_Post ==> Invalid session ID: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x00E2E7D3+124883]\n\tOrdinal0 [0x00E2E7B1+124849]\n\tGetHandleVerifier [0x01078530+193488]\n\tGetHandleVerifier [0x01094B2C+309708]\n\tGetHandleVerifier [0x010B15F7+427159]\n\tGetHandleVerifier [0x010AF7A1+419393]\n\tGetHandleVerifier [0x010AF2F4+418196]\n\tGetHandleVerifier [0x0105EE04+89252]\n\tGetHandleVerifier [0x0105F2F6+90518]\n\tGetHandleVerifier [0x0105F601+91297]\n\tGetHandleVerifier [0x011531EC+1089676]\n\tGetHandleVerifier [0x011517C9+1082985]\n\tGetHandleVerifier [0x011513A3+1081923]\n\tGetHandleVerifier [0x0124D9FD+2115741]\n\tOrdinal0 [0x00F7B82E+1488942]\n\tOrdinal0 [0x00F15A7D+1071741]\n\tGetHandleVerifier [0x0105EB9B+88635]\n\tGetHandleVerifier [0x0105E56E+87054]\n\tGetHandleVerifier [0x01255D0C+2149292]\n\tBaseThreadInitThunk [0x772E6359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77CD87A4+228]\n\tRtlGetAppContainerNamedObjectPath [0x77CD8774+180]\n"}}
_WD_FindElement: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x00E2E7D3+124883]\n\tOrdinal0 [0x00E2E7B1+124849]\n\tGetHandleVerifier [0x01078530+193488]\n\tGetHandleVerifier [0x01094B2C+309708]\n\tGetHandleVerifier [0x010B15F7+427159]\n\tGetHandleVerifier [0x010AF7A1+419393]\n\tGetHandleVerifier [0x010AF2F4+418196]\n\tGetHandleVerifier [0x0105EE04+89252]\n\tGetHandleVerifier [0x0105F2F6+90518]\n\tGetHandleVerifier [0x0105F601+91297]\n\tGetHandleVerifier [0x011531EC+1089676]\n\tGetHandleVerifier [0x011517C9+1082985]\n\tGetHandleVerifier [0x011513A3+1081923]\n\tGetHandleVerifier [0x0124D9FD+2115741]\n\tOrdinal0 [0x00F7B82E+1488942]\n\tOrdinal0 [0x00F15A7D+1071741]\n\tGetHandleVerifier [0x0105EB9B+88635]\n\tGetHandleVerifier [0x0105E56E+87054]\n\tGetHandleVerifier [0x01255D0C+2149292]\n\tBaseThreadInitThunk [0x772E6359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77CD87A4+228]\n\tRtlGetAppContainerNamedObjectPath [0x77CD8774+180]\n"}}
_WD_FindElement ==> Invalid session ID: HTTP status = 404
__WD_Get: URL=HTTP://127.0.0.1:9515/session/CDwindow-632D3A6BC93476CDE6A5484906545BED/element//property/innerText
__WD_Get: StatusCode=404; $iResult = 15; $sResponseText={"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOr...
__WD_Get ==> Invalid session ID: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x00E2E7D3+124883]\n\tOrdinal0 [0x00E2E7B1+124849]\n\tGetHandleVerifier [0x01078530+193488]\n\tGetHandleVerifier [0x01094B2C+309708]\n\tGetHandleVerifier [0x010B15F7+427159]\n\tGetHandleVerifier [0x010AF7A1+419393]\n\tGetHandleVerifier [0x010AF2F4+418196]\n\tGetHandleVerifier [0x0105EE04+89252]\n\tGetHandleVerifier [0x0105F2F6+90518]\n\tGetHandleVerifier [0x0105F601+91297]\n\tGetHandleVerifier [0x011531EC+1089676]\n\tGetHandleVerifier [0x011517C9+1082985]\n\tGetHandleVerifier [0x011513A3+1081923]\n\tGetHandleVerifier [0x0124D9FD+2115741]\n\tOrdinal0 [0x00F7B82E+1488942]\n\tOrdinal0 [0x00F15A7D+1071741]\n\tGetHandleVerifier [0x0105EB9B+88635]\n\tGetHandleVerifier [0x0105E56E+87054]\n\tGetHandleVerifier [0x01255D0C+2149292]\n\tBaseThreadInitThunk [0x772E6359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77CD87A4+228]\n\tRtlGetAppContainerNamedObjectPath [0x77CD8774+180]\n"}}
_WD_ElementAction: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOr...
_WD_ElementAction ==> Invalid session ID: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x00E2E7D3+124883]\n\tOrdinal0 [0x00E2E7B1+124849]\n\tGetHandleVerifier [0x01078530+193488]\n\tGetHandleVerifier [0x01094B2C+309708]\n\tGetHandleVerifier [0x010B15F7+427159]\n\tGetHandleVerifier [0x010AF7A1+419393]\n\tGetHandleVerifier [0x010AF2F4+418196]\n\tGetHandleVerifier [0x0105EE04+89252]\n\tGetHandleVerifier [0x0105F2F6+90518]\n\tGetHandleVerifier [0x0105F601+91297]\n\tGetHandleVerifier [0x011531EC+1089676]\n\tGetHandleVerifier [0x011517C9+1082985]\n\tGetHandleVerifier [0x011513A3+1081923]\n\tGetHandleVerifier [0x0124D9FD+2115741]\n\tOrdinal0 [0x00F7B82E+1488942]\n\tOrdinal0 [0x00F15A7D+1071741]\n\tGetHandleVerifier [0x0105EB9B+88635]\n\tGetHandleVerifier [0x0105E56E+87054]\n\tGetHandleVerifier [0x01255D0C+2149292]\n\tBaseThreadInitThunk [0x772E6359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77CD87A4+228]\n\tRtlGetAppContainerNamedObjectPath [0x77CD8774+180]\n"}}
>Exit code: 0    Time: 157.2

 

HTML of source:

image.png.c1894a18f12d6da05db5e66b21a81573.png

image.png

Link to comment
Share on other sites

14 minutes ago, TheOne23 said:

_WDStartup: WD.au3: 0.4.0.1 (Update available)

_WDStartup: WinHTTP:    1.6.4.1 (Download latest source at <https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3>)

This information is here for your benefit. Please update both accordingly if you want support. 😉

17 minutes ago, TheOne23 said:

local $new_session = _WD_Attach($sSession, 'IM and Chat | ServiceNow',Default)

Check the function header for details on this function's return value, which isn't a session ID. :rolleyes:

Link to comment
Share on other sites

I'm running into two issues, which I think are likely unrelated to the UDF's code, but I haven't confirmed yet. It is very possible that these are MS Edge issues.

My first issue (I should say annoyance) is that I usually start MS Edge maximized, go to an internal site, have the user log in, then minimize the window while the program runs. When I activate the window manually, it comes back not maximized as I'd expect.

The second issue is when I'm using Edge to watch for incoming applications. I follow the process above, load the application page, and check for any new ones. If there aren't, then I let the program idle for 3 minutes before refreshing. After about 12 minutes, _WD_Navigate returns a WebDriver Exception error with 404 saying the window doesn't exist anymore. I can restore the window and watch the page finish loading (thereby confirming I'm not logged out and the window still exists). The issue disappears if I don't minimize the window. I tried maximizing the window if this error occurs, but _WD_Window returns the same error when I attempt to maximize it.

N.B. I'm somehow running v0.3.1.0, so I'm updating now, but I didn't notice any related changes in the UDF

Edit: No change when using v0.4.0.2

Edit 2: See later comment, Edge is discarding the tab -- https://www.autoitscript.com/forum/topic/205553-webdriver-udf-help-support-iii/?do=findComment&comment=1482780

Edit 3: Fixed it! https://www.autoitscript.com/forum/topic/205553-webdriver-udf-help-support-iii/?do=findComment&comment=1486358

 

Edited by seadoggie01

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

Hey, 

a really nice UDF! :) I have 2 questions:

  1. How can I size the window? I found "_WD_Window() with "rect", but I couldnt find any informations about the syntax of the options... "maximize" and "fullscreen" are working, but I would like to set a specific size. I tried a lot of things, but Stackoverflow and Google just answer it for Python and other toolings. For example "--height=1440" isnt working.
    • And can I set that somehow directly with the session start? Maybe with the "$sDesiredCapabilities"?
  2. Is it possible to force the Chrome Driver to use your "normal Chrome"? Like all extensions, cookies and my logged in Google account... After the session he really forgets everything :)
    • I just want to start some pages, do stuff and "take over by myself". And its really akward to miss extensions, cookies and the logged in Google account ^^

 

Thank you!

Edited by Acanis
Link to comment
Share on other sites

3 hours ago, Danp2 said:

@Acanis

1. This has been already been covered in a previous generation of this thread. Try searching the forum for "rect"

1a. Not sure off hand. Let us know if you figure out a way. 😉

2. See FAQ #3 in the wiki

Thank you :)

To (2) (FAQ #3) => Its a little "problematic". Your solution brings me to

Quote

user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir

I found some input about that. The problem seems to be, that I already use my Chrome profile and the new instance with the same profile is a problem for Chrome. So I have to end existing Chrome instances, before using the code or I have to use a different profile for the Web Driver, but the new profile wouldnt be synced.

Both ways are not "optimal"^^. 

As far as I read some of your answers, I cant join an existing session of Chrome, right? (Just, if the session was started with Chrome Driver and the same parameters)

 

Do you have any idea?

 

*edit*

Even with another profile I get the error and no valid session id, because he cant move the cache. Hes starting the instance with the new profile, but he still tries to use the already used cache, hmmm...

---

https://stackoverflow.com/questions/59987080/invalidargumentexception-message-invalid-argument-user-data-directory-is-alre

https://forum.katalon.com/t/user-data-directory-is-already-in-use/40266/2

https://stackoverflow.com/questions/50635087/how-to-open-a-chrome-profile-through-user-data-dir-argument-of-selenium

Edited by Acanis
Link to comment
Share on other sites

@Acanis As you've found out, you can't have multiple instances of Chrome using the same user profile. Not sure why you are encountering the cache issue. Perhaps you could provide a brief example so that we can observe what you are attempting to do.

You can attach to an existing Chrome instance, but only if it was started with the --remote-debugging-port commandline option. See below for example --

#include "wd_core.au3"

Local $sDesiredCapabilities, $sSession

ShellExecute("chrome.exe", "--remote-debugging-port=9222")

SetupChrome()
_WD_Startup()

$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Navigate($sSession, "http://yahoo.com")

Func SetupChrome()
_WD_Option('Driver', 'chromedriver.exe')
_WD_Option('Port', 9515)
_WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"')

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"debuggerAddress": "localhost:9222"}}}}'
EndFunc

 

Link to comment
Share on other sites

I confirmed the minimize issue with Chrome, so I'd guess it's the webdrivers themselves causing this. I'm attempting to recreate the timeout issue on Chrome as well, but that will take longer to check.

Spoiler

Minimize/Maximize issue: When the script is finished, restore Chrome and note the size of the window

#include <wd_core.au3>
#include <wd_helper.au3>

_WD_Option("Driver", @ScriptDir & "\chromedriver.exe")
_WD_Option("Port", 9515)
_WD_UpdateDriver("chrome", Default, True, True)
_WD_Startup()
Global $sSession = _WD_CreateSession('{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}')
_WD_Window($sSession, "Maximize")
_WD_Window($sSession, "minimize")

 

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

Hi @Danp2,

 

Thanks for your fast answer.
I noticed that function and was already playing with it, now that i know i certainly need that i will dig a little deeper!


One non-related question;
Is it possible to detect if a Chrome window is in Full-screen mode or not?
Because sometimes my screen's are getting back to normal mode suddenly and if i detect that i will bring it back to full-screen :)

Many Thanks! :) 

Link to comment
Share on other sites

  • Danp2 changed the title to WebDriver UDF (W3C compliant version) - 07/29/2022
  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...