SOLVE-SMART Posted January 8, 2023 Share Posted January 8, 2023 (edited) Hi @iSan, like @Danp2 already suggested: Please get familiar with the Chrome DevTools and XPath. Many of your questions so far, could be solved by the correct usage of XPath. So please share more than just a single html <tag> which you are looking for. Do you understand what I am doing here in the animated gif? Please try to provide screenshots, DOM snippets etc., thanks 🤝 . Best regards Sven Edited January 8, 2023 by SOLVE-SMART Stay innovative! Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted January 8, 2023 Share Posted January 8, 2023 (edited) Okay as a further explanation @iSan: I called the URL https://www.w3schools.com/html/html_tables.asp I pressed [F12] to open the DevTools I inspected a cell of the table I pressed [CTRL] + [F] to open up the "Find by XPath" input box I searched for the correct table by ID and added //tr to get all rows I hope this helps. Best regardsSven Edited January 8, 2023 by SOLVE-SMART Stay innovative! Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
Danp2 Posted January 8, 2023 Author Share Posted January 8, 2023 @iSanPlease try to be more detailed in your posts. When you make statements like Quote I try to get how many line/row in a table. Firstly, i use _WD_GetTable but did not work. and Quote And i saw in Func _WD_GetTable of wd_helper.au3 that the id of extended xpath lack a / before tbody and tr right? it comes across (at least to me) as if you are implying that there is an issue with the UDF. Based on what you've posted thus far, the issue is that you used the wrong xpath with _WD_GetTable. If you think there's a problem with the coding of _WD_GetTable, please elaborate. SOLVE-SMART 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
iSan Posted January 8, 2023 Share Posted January 8, 2023 (edited) @SOLVE-SMARTThanks, you enthusiastically support. 17 minutes ago, SOLVE-SMART said: Okay as a further explanation: I know what are you doing, with your help, the return value is only 1 row, it should be 12. I show image of my Table, and DOM. Fixed my code: $tables = _WD_GetTable($sSession, "//table[@id='ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_gridTable']") $numRow = UBound($tables) MsgBox(0, "", $numRow) @Danp2 i should delete my post. Totally my mistake, UDF works well. Quote it comes across (at least to me) as if you are implying that there is an issue with the UDF. Based on what you've posted thus far, the issue is that you used the wrong xpath with _WD_GetTable. If you think there's a problem with the coding of _WD_GetTable, please elaborate. Edited January 8, 2023 by iSan Link to comment Share on other sites More sharing options...
Danp2 Posted January 8, 2023 Author Share Posted January 8, 2023 @iSanThanks for clarifying. No need to delete it, but you can certainly go back and edit it to avoid any future confusion. 😉 iSan 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted January 8, 2023 Share Posted January 8, 2023 (edited) Your code snippet returns only 1 ==> yes, because you ask for tables instead of table rows! Please try this again. You should get your count of 12 table rows by my _GetElementsCount() example. Best regardsSven Edited January 8, 2023 by SOLVE-SMART Stay innovative! Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
iSan Posted January 8, 2023 Share Posted January 8, 2023 @SOLVE-SMART I tryed before, is my code right? $aTable = _WD_FindElement($sSession, 'xpath', '//table[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_gridTable"]//tr', Default, True) $numTable = UBound($aTable) ConsoleWrite("How many row?" &$numTable) And _WD_FindElement ==> Success [0] : Parameters: Strategy=xpath Selector=//table[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_gridTable"]//tr StartNodeID=Default Multiple=True ShadowRoot=Default How many row?1>Exit code: 0 SOLVE-SMART 1 Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted January 9, 2023 Share Posted January 9, 2023 Hi @iSan, yes your last code snippet looks good/should be correct. So you still only receive one element which could be caused by an loading issue of the website. It's not very likely, but please add __WD_Sleep(2000) before you try to get the table rows. Just as an tryout. Could you maybe show us more screenshots from the website? Simply set MsgBox() commands before and after, take a screenshot, that's it. Best regards Sven Stay innovative! Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
iSan Posted January 17, 2023 Share Posted January 17, 2023 I have input id of this cell 1.1, Value of this cell = "AA004036", the title = "MMSZ5242BS-7-F" = value of cell 1.2 (see below) Cell 1.2 Can you guys suggest me any function to get value of cell 1.2 ( = "MMSZ5242BS-7-F") I tryed _WD_ElementAction with $sCommand = Property, $sOption = "outerHTML" But where can i get other $sOption? $sSelectElement = _WD_FindElement($sSession, 'xpath', '//input[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_inputCell_1.1"]') $sValueElement = _WD_ElementAction($sSession, $sSelectElement, "PROPERTY", "outerHTML") MsgBox(0, "", $sValueElement) ConsoleWrite($sValueElement) Result: <input id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_inputCell_1.1" ondrop="return false" spellcheck="false" autocomplete="off" onchange="if($func.clientChange(this)) onChange$GridVoucherDetail$Item(this);" onfocus="$find('ctl00_FastBusiness_MainReport_dirExtender_FormGridd98')._focus(this);" onblur="$find('ctl00_FastBusiness_MainReport_dirExtender_FormGridd98')._blur(this);" class="CellInput TextInput " type="text" value="" oncontextmenu="$func.showContextMenu(event, this, 'v', false);return false;" tabindex="-1"> Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted January 17, 2023 Share Posted January 17, 2023 Hi @iSan, if you want to get the value of the title attribute you have to use "attribute" instead of "property". Get value of title would look like this: _WD_ElementAction($sSession, $sSelectElement, "attribute", "title") Get value of value would look like this: _WD_ElementAction($sSession, $sSelectElement, "attribute", "value") But your <input> with the ID suffix _inputCell_1.2 don't have a filled value attribute. So which information do you want? Best regards Sven iSan 1 Stay innovative! Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
iSan Posted January 17, 2023 Share Posted January 17, 2023 (edited) 30 minutes ago, SOLVE-SMART said: Get value of title would look like this: _WD_ElementAction($sSession, $sSelectElement, "attribute", "title") @SOLVE-SMART That actuatly works, i need to put a sleep(1000) between 2 codes. Thank you for that. But where can i get other $sOption of this? _WD_ElementAction($sSession, $sSelectElement, "attribute", $sOption) The infomation i need is value = "MMSZ5242BS-7-F" of cell 1.2 but there are no infomation in <input> Edited January 17, 2023 by iSan Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted January 17, 2023 Share Posted January 17, 2023 (edited) Did you already tried: _WD_ElementAction($sSession, $sSelectElement, "value") ? Or even "text" instead? Best regards Sven Edited January 17, 2023 by SOLVE-SMART Stay innovative! Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
Danp2 Posted January 17, 2023 Author Share Posted January 17, 2023 4 hours ago, iSan said: But where can i get other $sOption? That would depend on the target element and the HTML specs. There are plenty of details on the net if you search for "html input properties attributes". Quote The infomation i need is value = "MMSZ5242BS-7-F" of cell 1.2 but there are no infomation in <input> Have you tried reading the value of this cell as suggested by @SOLVE-SMARTabove? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
iSan Posted January 18, 2023 Share Posted January 18, 2023 14 hours ago, SOLVE-SMART said: Did you already tried: _WD_ElementAction($sSession, $sSelectElement, "value") ? Or even "text" instead? @SOLVE-SMART Already tryed "value" and "text" but got nothing. Maybe value in that cell is inherited data so it can be show but can not read. Idk _WD_ElementAction($sSession, $sSelectElement, "value", Default) Link to comment Share on other sites More sharing options...
Mozzilo Posted January 18, 2023 Share Posted January 18, 2023 Hi all, I've been using AutoIT for a while now and this forum has been very useful. Thanks everyone! I hit a brick wall recently. I'm trying to update my old script so it uses Edge instead of IE. The program uses a GUI that opens the WebDriver and Edge in headless mode on startup. From the GUI, a user may run up to 6 child processes. The child processes have to navigate to different websites and look for keywords (within their own tabs) and act accordingly to findings. All that works fine if I run one child process. The trouble starts when I try to run multiple child processes. The error I get is: __WD_Post ==> Invalid session ID [15] : HTTP status = 404 _WD_Navigate ==> Invalid session ID [15] : Parameters: URL=https://www.bing.com/ I managed to run two child processes simultaneously without them conflicting with each other a few times from my GUI. The child processes were compiled. If I run them immediately one after the other they (sometimes) do not conflict with each other. However, every time I try to run the third process, the first two stop working. This gives me hope that it is possible to get it working. Here's a bit of code I have been experimenting on. I have modified the code provided by @mLipok to suit my needs and my actual code uses it. Thanks for that. expandcollapse popup#include "wd_helper.au3" #include "wd_capabilities.au3" # HOW TO TEST: ; At first run choose [Yes] to create new session Edge running instance ; At second run choose [No] to attach to active Edge running instance # TODO: ; https://github.com/operasoftware/operachromiumdriver/blob/master/docs/desktop.md --remote-debugging-port=port Global $_MY__WD_SESSION Global $__g_sDownloadDir = "" $WD_DEBUG = $_WD_DEBUG_Full _Test() Exit Func _Test() Local $iAnswer = MsgBox($MB_YESNO + $MB_TOPMOST + $MB_ICONQUESTION + $MB_DEFBUTTON2, "Question", _ "Open new sesion ?" & @CRLF & "[ NO ] = Try attach to active edge instance") If $iAnswer = $IDYES Then _Testing_CreateSession() Return ; do not process next functions Else _Testing_AttachSession() _WD_NewTab($_MY__WD_SESSION) While 1 _WD_Navigate($_MY__WD_SESSION, 'https://www.google.com/') Sleep(1000) _WD_Navigate($_MY__WD_SESSION, 'https://www.bing.com/') Sleep(1000) WEnd EndIf $iAnswer = MsgBox($MB_YESNO + $MB_TOPMOST + $MB_ICONQUESTION + $MB_DEFBUTTON2, "Question", _ "Do you want to test ?" & @CRLF & "[ NO ] = Refresh - prevent expiration") If $iAnswer = $IDYES Then _Testing_WD_Navigate() Else _Testing_Refreshing() EndIf ; CleanUp _WD_DeleteSession($_MY__WD_SESSION) _WD_Shutdown() EndFunc ;==>_Test Func _Testing_CreateSession() $_MY__WD_SESSION = _MY__WD_SetupEdge(False, $__g_sDownloadDir, False) EndFunc ;==>_Testing_CreateSession Func _Testing_AttachSession() $_MY__WD_SESSION = _MY__WD_SetupEdge(False, $__g_sDownloadDir, True) EndFunc ;==>_Testing_AttachSession Func _Testing_Refreshing() While 1 ;~ _WD_Navigate($_MY__WD_SESSION, '') _WD_Action($_MY__WD_SESSION, 'REFRESH') Local $iAnswer = MsgBox($MB_YESNO + $MB_TOPMOST + $MB_ICONQUESTION + $MB_DEFBUTTON2, "Question", "Finish refreshing?" & @CRLF & "[No] = Refresh - prevent expiration", 60) If $iAnswer = $IDYES Then Return WEnd EndFunc ;==>_Testing_Refreshing Func _Testing_WD_Navigate() _WD_Navigate($_MY__WD_SESSION, 'https://www.autoitscript.com/forum') EndFunc ;==>_Testing_WD_Navigate Func _MY__WD_SetupEdge($b_Headless, $s_Download_dir = Default, $bTryAttach = False) If $s_Download_dir = Default Then $s_Download_dir = '' ElseIf $s_Download_dir Then If FileExists($s_Download_dir) = 0 Then $s_Download_dir = '' EndIf ;_WD_UpdateDriver('Edge') If @error Then Return SetError(@error, @extended, '') _WD_Option('Driver', 'msedgedriver.exe') _WD_Option('Port', 9515) _WD_CapabilitiesStartup() ;Local $s_AttachOption = (($bTryAttach) ? ("") : (" --remote-debugging-port=9222")) ;_WD_Option('DriverParams', '--log trace' & $s_AttachOption) _WD_CapabilitiesAdd('firstMatch', 'msedge') _WD_CapabilitiesAdd('w3c', True) _WD_CapabilitiesAdd('detach', False) _WD_CapabilitiesAdd('binary', "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe") If $bTryAttach Then _WD_CapabilitiesAdd('debuggerAddress', 'localhost:9222') Else _WD_CapabilitiesAdd('args', '--remote-debugging-port=9222') EndIf If $b_Headless Then _ _WD_CapabilitiesAdd('args', '--headless') If $s_Download_dir Then _ _WD_CapabilitiesAdd('prefs', 'download.default_directory', $s_Download_dir) _WD_CapabilitiesDump(@ScriptLineNumber & ' :WebDriver:Capabilities:') _WD_Startup() If @error Then Return SetError(@error, @extended, '') Local $s_Capabilities = _WD_CapabilitiesGet() Local $WD_SESSION = _WD_CreateSession($s_Capabilities) Return SetError(@error, @extended, $WD_SESSION) EndFunc ;==>_MY__WD_SetupEdge Console: expandcollapse popup#1: Starting process #1 "C:\Program Files (x86)\AutoIt3\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "d:\TS1959\TS1959 V2.0 DEV one server\edge_attach.au3" [PID 9300] +>16:21:45 Starting AutoIt3Wrapper (19.1127.1402.0} from:Code.exe (1.73.1.0) Keyboard:00000809 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0409) >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:d:\TS1959\TS1959 V2.0 DEV one server\edge_attach.au3 +>16:21:45 AU3Check ended.rc:0 >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "d:\TS1959\TS1959 V2.0 DEV one server\edge_attach.au3" /errorstdout +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop. _WD_Option ==> Success [0] : Parameters: Option=Driver Value=msedgedriver.exe _WD_Option ==> Success [0] : Parameters: Option=Port Value=9515 _WD_CapabilitiesAdd ==> Success [0] : Successfully used [firstMatch] with specified browser: msedge _WD_CapabilitiesAdd ==> Success [0] : Successfully added capability _WD_CapabilitiesAdd ==> Success [0] : Successfully added capability _WD_CapabilitiesAdd ==> Success [0] : Successfully added capability _WD_CapabilitiesAdd ==> Success [0] : Successfully added capability _WD_CapabilitiesDump: JSON structure starts below: 103 :WebDriver:Capabilities: { "capabilities":{ "firstMatch":[ { "ms:edgeOptions":{ "binary":"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe", "args":[ "--remote-debugging-port=9222" ] } } ] } } _WD_CapabilitiesDump: JSON structure ends above. _WD_IsLatestRelease ==> Success [0] : True _WD_Startup: OS: WIN_10 WIN32_NT 19044 _WD_Startup: AutoIt: 3.3.14.5 _WD_Startup: Webdriver UDF: 0.11.0 (Up to date) _WD_Startup: WinHTTP: 1.6.4.1 (Download latest source at <https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3>) _WD_Startup: Driver: msedgedriver.exe (32 Bit) _WD_Startup: Params: _WD_Startup: Port: 9515 _WD_Startup: Command: "msedgedriver.exe" _WD_Startup ==> Success [0] __WD_Post ==> Success [0] : HTTP status = 200 _WD_CreateSession ==> Success [0] : 24b684615014c4a222d1738961df3d1d #2: Starting process #2 "C:\Program Files (x86)\AutoIt3\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "d:\TS1959\TS1959 V2.0 DEV one server\edge_attach.au3" [PID 5676] +>16:21:52 Starting AutoIt3Wrapper (19.1127.1402.0} from:Code.exe (1.73.1.0) Keyboard:00000809 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0409) >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:d:\TS1959\TS1959 V2.0 DEV one server\edge_attach.au3 +>16:21:53 AU3Check ended.rc:0 >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "d:\TS1959\TS1959 V2.0 DEV one server\edge_attach.au3" /errorstdout +>Setting Hotkeys...--> Press Ctrl+Alt+Pausebreak to Restart or Ctrl+Pausebreak to Stop. _WD_Option ==> Success [0] : Parameters: Option=Driver Value=msedgedriver.exe _WD_Option ==> Success [0] : Parameters: Option=Port Value=9515 _WD_CapabilitiesAdd ==> Success [0] : Successfully used [firstMatch] with specified browser: msedge _WD_CapabilitiesAdd ==> Success [0] : Successfully added capability _WD_CapabilitiesAdd ==> Success [0] : Successfully added capability _WD_CapabilitiesAdd ==> Success [0] : Successfully added capability _WD_CapabilitiesAdd ==> Success [0] : Successfully added capability _WD_CapabilitiesDump: JSON structure starts below: 103 :WebDriver:Capabilities: { "capabilities":{ "firstMatch":[ { "ms:edgeOptions":{ "binary":"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe", "debuggerAddress":"localhost:9222" } } ] } } _WD_CapabilitiesDump: JSON structure ends above. _WD_IsLatestRelease ==> Success [0] : True _WD_Startup: OS: WIN_10 WIN32_NT 19044 _WD_Startup: AutoIt: 3.3.14.5 _WD_Startup: Webdriver UDF: 0.11.0 (Up to date) _WD_Startup: WinHTTP: 1.6.4.1 (Download latest source at <https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3>) _WD_Startup: Driver: msedgedriver.exe (32 Bit) _WD_Startup: Params: _WD_Startup: Port: 9515 _WD_Startup: Command: "msedgedriver.exe" _WD_Startup ==> Success [0] __WD_Post ==> Success [0] : HTTP status = 200 _WD_CreateSession ==> Success [0] : 7ab36aeb7e89c5e4e823278c602f5d68 __WD_Get ==> Success [0] : HTTP status = 200 _WD_Window ==> Success [0] : Parameters: Command=window Option=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_Window ==> Success [0] : Parameters: Command=new Option={"type":"tab"} __WD_Post ==> Success [0] : HTTP status = 200 _WD_Window ==> Success [0] : Parameters: Command=Switch Option={"handle":"CDwindow-E4BC94DC56CAAAA261A726EBB16F6EEA"} _WD_NewTab ==> Success [0] : Parameters: Switch=Default Timeout=Default URL=Default Features=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_Navigate ==> Success [0] : Parameters: URL=https://www.google.com/ #3: Starting process #3 "C:\Program Files (x86)\AutoIt3\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "d:\TS1959\TS1959 V2.0 DEV one server\edge_attach.au3" [PID 15024] +>16:21:59 Starting AutoIt3Wrapper (19.1127.1402.0} from:Code.exe (1.73.1.0) Keyboard:00000809 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0409) >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:d:\TS1959\TS1959 V2.0 DEV one server\edge_attach.au3 #2: __WD_Post ==> Success [0] : HTTP status = 200 _WD_Navigate ==> Success [0] : Parameters: URL=https://www.bing.com/ #3: +>16:22:00 AU3Check ended.rc:0 >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "d:\TS1959\TS1959 V2.0 DEV one server\edge_attach.au3" /errorstdout +>Setting Hotkeys...--> Press Ctrl+Alt+Pausebreak to Restart or Ctrl+Pausebreak to Stop. #2: __WD_Post ==> Success [0] : HTTP status = 200 _WD_Navigate ==> Success [0] : Parameters: URL=https://www.google.com/ #3: _WD_Option ==> Success [0] : Parameters: Option=Driver Value=msedgedriver.exe _WD_Option ==> Success [0] : Parameters: Option=Port Value=9515 _WD_CapabilitiesAdd ==> Success [0] : Successfully used [firstMatch] with specified browser: msedge _WD_CapabilitiesAdd ==> Success [0] : Successfully added capability _WD_CapabilitiesAdd ==> Success [0] : Successfully added capability _WD_CapabilitiesAdd ==> Success [0] : Successfully added capability _WD_CapabilitiesAdd ==> Success [0] : Successfully added capability _WD_CapabilitiesDump: JSON structure starts below: 103 :WebDriver:Capabilities: { "capabilities":{ "firstMatch":[ { "ms:edgeOptions":{ "binary":"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe", "debuggerAddress":"localhost:9222" } } ] } } _WD_CapabilitiesDump: JSON structure ends above. #2: __WD_Post ==> Invalid session ID [15] : HTTP status = 404 _WD_Navigate ==> Invalid session ID [15] : Parameters: URL=https://www.bing.com/ #3: _WD_IsLatestRelease ==> Success [0] : True _WD_Startup: OS: WIN_10 WIN32_NT 19044 _WD_Startup: AutoIt: 3.3.14.5 _WD_Startup: Webdriver UDF: 0.11.0 (Up to date) _WD_Startup: WinHTTP: 1.6.4.1 (Download latest source at <https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3>) _WD_Startup: Driver: msedgedriver.exe (32 Bit) _WD_Startup: Params: _WD_Startup: Port: 9515 _WD_Startup: Command: "msedgedriver.exe" _WD_Startup ==> Success [0] __WD_Post ==> Success [0] : HTTP status = 200 _WD_CreateSession ==> Success [0] : a430641de274bdf28198f4c936786e75 __WD_Get ==> Success [0] : HTTP status = 200 _WD_Window ==> Success [0] : Parameters: Command=window Option=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_Window ==> Success [0] : Parameters: Command=new Option={"type":"tab"} __WD_Post ==> Success [0] : HTTP status = 200 _WD_Window ==> Success [0] : Parameters: Command=Switch Option={"handle":"CDwindow-DA41450416DD5749E8BA5D2C07DAE0AA"} _WD_NewTab ==> Success [0] : Parameters: Switch=Default Timeout=Default URL=Default Features=Default #2: __WD_Post ==> Invalid session ID [15] : HTTP status = 404 _WD_Navigate ==> Invalid session ID [15] : Parameters: URL=https://www.google.com/ #3: __WD_Post ==> Success [0] : HTTP status = 200 _WD_Navigate ==> Success [0] : Parameters: URL=https://www.google.com/ #2: __WD_Post ==> Invalid session ID [15] : HTTP status = 404 _WD_Navigate ==> Invalid session ID [15] : Parameters: URL=https://www.bing.com/ #3: __WD_Post ==> Success [0] : HTTP status = 200 _WD_Navigate ==> Success [0] : Parameters: URL=https://www.bing.com/ #2: __WD_Post ==> Invalid session ID [15] : HTTP status = 404 _WD_Navigate ==> Invalid session ID [15] : Parameters: URL=https://www.google.com/ #3: __WD_Post ==> Success [0] : HTTP status = 200 _WD_Navigate ==> Success [0] : Parameters: URL=https://www.google.com/ #2: __WD_Post ==> Invalid session ID [15] : HTTP status = 404 _WD_Navigate ==> Invalid session ID [15] : Parameters: URL=https://www.bing.com/ #3: __WD_Post ==> Success [0] : HTTP status = 200 _WD_Navigate ==> Success [0] : Parameters: URL=https://www.bing.com/ #2: ! Program will be cancelled. +>16:22:08 AutoIt3Wrapper Finished. >>Exit code 0 Time: 16.194 #3: >>Exit code 0 (SIGTERM) Time: 10.194 #1: >>Exit code 0 (SIGTERM) Time: 25.173 Running on Windows 10. Edge: Version 108.0.1462.76 (Official build) (64-bit) Driver: 108.0.1462.76 Any help would be much appreciated! Include.zip msedge.log Link to comment Share on other sites More sharing options...
Danp2 Posted January 18, 2023 Author Share Posted January 18, 2023 56 minutes ago, Mozzilo said: _WD_Startup: WinHTTP: 1.6.4.1 (Download latest source at <https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3>) You should fix the above to avoid some known issues. Otherwise, I believe the issue you describe is due to the webdriver being shutdown and relaunched by _WD_Startup. This is controlled by a couple of _WD_Option settings (driverclose and driverdetect). You should be able to find some prior discussions regarding these settings if you search the forums. Remember that you will also need to use a separate port number for each instance of the webdriver. You may also want to research to see if you can use a single instance of Edgedriver to control multiple webdriver sessions (I know that Chrome used to be able to do this). P.S. Nice to see another VSCode fan. 😉 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Mozzilo Posted January 19, 2023 Share Posted January 19, 2023 Thanks Danp2 for the quick reply. You have potentially saved me hours of headache. The solution was to add the line: _WD_Option('DriverClose', False) Cheers! P.S. VSCode is great. It made my coding so much quicker Link to comment Share on other sites More sharing options...
DoVinhTrung Posted January 19, 2023 Share Posted January 19, 2023 @Danp2how to conver selenium windowhandle to winapi hwnd Link to comment Share on other sites More sharing options...
Danp2 Posted January 19, 2023 Author Share Posted January 19, 2023 @DoVinhTrungSorry, but I don't understand the question. Please explain / elaborate on -- what you mean by "selenium windowhandle" how you obtained this value how you intend to use the winapi hwnd the specific Windows API that you intend to use Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
DoVinhTrung Posted January 19, 2023 Share Posted January 19, 2023 1 hour ago, Danp2 said: @DoVinhTrungSorry, but I don't understand the question. Please explain / elaborate on -- what you mean by "selenium windowhandle" how you obtained this value how you intend to use the winapi hwnd the specific Windows API that you intend to use i use _WD_Window($sSession, 'handles') to have string hwnd current tab chorme :CDwindow-CF0F8560CF4DA6BBB53ABF372950987E i want conver CDwindow-CF0F8560CF4DA6BBB53ABF372950987E to hwnd hex (0x123abc) Link to comment Share on other sites More sharing options...
Recommended Posts