iSan Posted January 6, 2023 Share Posted January 6, 2023 (edited) Really thank to @SOLVE-SMART and @Danp2 are trying to help me. I show more of the DOM, because this web need Login so i can not share. - I try to SetInputValue in the <input id="ctl00_FastBusiness_MainReport_dirExtender_form_ngay_lct"> contains special characters in datatype: <value=" / / "> it's date type, and default <text="04/01/2023"> . Firstly, i do clearring the <input> with _WD_ClearElement but it does not work. Then i use _WD_SetInputValue, my input value : 05052022, default="04/01/2023", it changes to "04/05/0520". I think ElementAction(...,'value') does click on midle of Element then put value. Is there any way to setvalue from left of Element? I don't know my explanation is hard to understand for you guys but i started fell hesitate because asking many times for a problem 😕 <td id="ctl00_FastBusiness_MainReport_dirExtender0_formCell_1.15" nowrap="" style="overflow:hidden;width:100%;padding:4px!important;" colspan="1" class="FormCell Required ctl00_FastBusiness_MainReport_dirExtender"> <div style="width:100%;overflow:hidden;vertical-align:middle;" class="FormContainer FormContainerInput "> <input id="ctl00_FastBusiness_MainReport_dirExtender_form_ngay_lct" onfocus="$df.focus(this);" onblur="$df.blur(this);" onkeypress="$df.keypress(event, this, 'ngay_lct');" style="text-align: left; width: 77px;" ondrop="return false" spellcheck="false" autocomplete="off" class="FormInput FormTextInput" type="text" value=" / / " oncontextmenu="$func.showContextMenu(event, this, 'v', false);return false;" text="04/01/2023"> </div> </td> 12 hours ago, Danp2 said: Lack of error checking. You should check the result of _WD_WaitElement before blindly continuing to call additional functions. - Tobe honest, i'm not a coder and noob in Autoit, use Autoit to support my office job. I never put a check Error in my other script 😐 Help me a code Check if @Error then stop scrip, not Exit 12 hours ago, Danp2 said: Your code is inefficient because it requires you to call _WD_WaitElement multiple times for the same xpath - I only call _WD_WaitElement twice, not much so i think that is not the concern. _WD_ClearElement($sSession, "//input[@id='ctl00_FastBusiness_MainReport_dirExtender_form_ngay_lct']") Sleep(300) _WD_SetInputValue($sSession, "//input[@id='ctl00_FastBusiness_MainReport_dirExtender_form_ngay_lct']", '05052022') Sleep(100) Func _WD_SetInputValue($sSession, $xPath, $Value) $Element = _WD_WaitElement($sSession, 'xpath', $xPath, 100, 100) _WD_ElementAction($sSession, $Element, 'value', $Value) EndFunc Func _WD_ClickElement($sSession, $xPath) $Element = _WD_WaitElement($sSession, 'xpath', $xPath, 100, 100) _WD_ElementAction($sSession, $Element, 'Click') EndFunc Func _WD_ClearElement($sSession, $xPath) $Element = _WD_WaitElement($sSession, 'xpath', $xPath, 100, 100) _WD_ElementAction($sSession, $Element, 'Clear') EndFunc Edited January 6, 2023 by iSan Link to comment Share on other sites More sharing options...
Danp2 Posted January 6, 2023 Author Share Posted January 6, 2023 14 minutes ago, iSan said: Help me a code Check if @Error then stop scrip, not Exit See _WD_LinkClickByText for an example of how to check for error after calling _WD_FindElement. Notice that it only proceeds with calling _WD_ElementAction if no error has occurred. Quote I only call _WD_WaitElement twice, not much so i think that is not the concern. Imagine doing this for lots of elements. It could make your script take twice as long to execute. Quote I show more of the DOM, because this web need Login so i can not share. Unfortunately, this doesn't help in this instance. Can you show us the results from plugging the URL into this link? That may help identify the framework being used. Another option is to use _WD_SetElementValue instead of _WD_ElementAction. Try changing the line -- _WD_ElementAction($sSession, $Element, 'value', $Value) to _WD_SetElementValue($sSession, $Element, $Value, $_WD_OPTION_Advanced) iSan 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
iSan Posted January 6, 2023 Share Posted January 6, 2023 3 hours ago, Danp2 said: _WD_SetElementValue($sSession, $Element, $Value, $_WD_OPTION_Advanced) @Danp2 Oh shjt. That acuatly works. Love you so much! 🤩😍 SOLVE-SMART and Danp2 2 Link to comment Share on other sites More sharing options...
SkysLastChance Posted January 6, 2023 Share Posted January 6, 2023 I am having a problem with one of the servers I am on. I can't seem to figure out the problem. It is working on 2 other identical servers. However, it will not work on my third. So something is difrent. I am just not sure what. expandcollapse popup;WebDriver Func #include <wd_core.au3> #include <wd_helper.au3> #include <ConnView.au3> ;this is used to check port. useful for multiple connections on the same server. ;Hotkey to stop the scirpt HotKeySet(("{ESC}"), "Terminate") ;Used for Webdriver Functions Global $sDesiredCapabilities, $sSession, $_Port, $aHandles Global $iAltPort = 9515 Global $aTCPArray = _CV_GetExtendedTcpTable() ;Finds a avalible port if running on RDC (Remote Desktop Computer) This is needed if multiple users are running a script on the server at the same time. ;Starts at 9515 and +1 after SetupChrome($iAltPort) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Loop Starts ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;What to do after chrome is open. Msgbox(0,"Yeah","Chrome is open") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func Terminate() _WD_DeleteSession($sSession) _WD_Shutdown() Exit EndFunc ;==>Terminate Func SetupChrome($iAltPort) ;Setup for chrome ports and chrome drive exe While 1 $_Port = _ArrayFindAll($aTCPArray, $iAltPort, 0, 0, 0, 0, 2) If @error Then ExitLoop Else $iAltPort = $iAltPort + 1 EndIf WEnd _WD_Option('Driver', 'chromedriver.exe') ; the .exe file name needs to be changed for each person _WD_Option('DriverParams', '--verbose --port=' & $iAltPort & ' --log-path="' & @ScriptDir & '\chrome.log"') _WD_Option('Port', $iAltPort) _WD_Option('DriverClose', False) _WD_Option('DriverDetect', False) $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\", "--profile-directory=Default"], "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false }}}}' ;MsgBox($MB_OK, 'Message', 'Click OK to start Chrome Driver at local port: ' & $iAltPort) _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_LoadWait($sSession) ;;Which site to navigate to. _WD_Navigate($sSession, "google.com") _WD_LoadWait($sSession) EndFunc ;==>SetupChrome Chrome will not open. I have had this problem in the past, but it always seemed to be because I had the wrong version of chrome driver. However, I know I have the right version. Here is my output. >"C:\Users\BOTIE05\Desktop\New Verision of AutoIT\New Verision of AutoIT\SciTe\..\AutoIt3.exe" /ErrorStdOut "C:\Users\BOTIE05\Desktop\Chrome Template.au3" _WD_Option ==> Success [0] : Parameters: Option=Driver Value=chromedriver.exe _WD_Option ==> Success [0] : Parameters: Option=DriverParams Value=--verbose --port=9515 --log-path="C:\Users\BOTIE05\Desktop\chrome.log" _WD_Option ==> Success [0] : Parameters: Option=Port Value=9515 _WD_Option ==> Success [0] : Parameters: Option=DriverClose Value=False _WD_Option ==> Success [0] : Parameters: Option=DriverDetect Value=False _WD_IsLatestRelease ==> General Error [1] _WD_Startup: OS: WIN_2019 WIN32_NT 17763 _WD_Startup: AutoIt: 3.3.16.0 _WD_Startup: Webdriver UDF: 0.10.1 (Update status unknown [1]) _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: chromedriver.exe (32 Bit) _WD_Startup: Params: --verbose --port=9515 --log-path="C:\Users\BOTIE05\Desktop\chrome.log" _WD_Startup: Port: 9517 _WD_Startup: Command: "chromedriver.exe" --verbose --port=9515 --log-path="C:\Users\BOTIE05\Desktop\chrome.log" _WD_Startup ==> Success [0] __WD_Post ==> Webdriver Exception [10] : HTTP status = 500 _WD_CreateSession ==> Webdriver Exception [10] _WD_LoadWait ==> Invalid session ID [15] : Parameters: Delay=Default Timeout=Default Element=Default __WD_Post ==> Invalid session ID [15] : HTTP status = 404 _WD_Navigate ==> Invalid session ID [15] : Parameters: URL=google.com _WD_LoadWait ==> Invalid session ID [15] : Parameters: Delay=Default Timeout=Default Element=Default Not really sure on how to read much of the chrome log. However, I did find this at the bottom. [1673039187.542][INFO]: [ec9653b0e61c705758686b9f1074c830] RESPONSE InitSession ERROR unknown error: cannot create temp dir for unpacking extensions [1673039187.542][DEBUG]: Log type 'driver' lost 2 entries on destruction [1673039187.542][DEBUG]: Log type 'browser' lost 0 entries on destruction I tried creating a folder inside my temp account and switching my environment variables. It diden't work though. You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted January 6, 2023 Share Posted January 6, 2023 (edited) Hi @SkysLastChance, hmm, an 500 Internal Server Error is quite annoying, I know. Is your Webdriver log level (debug) set to full? $_WD_DEBUG = $_WD_DEBUG_Full Maybe you can get more information from the Webdriver, but I guess not 😔 . Please ensure that your Chrome is really the expected and correct one. I saw you wrote it, but when you call _WD_UpdateDriver() with the $bForce parameter, does it change in any aspect? Did you tried it with firefox? In case you get the same result, it's more clear it's not the fault of Webdriver as you already assumed too, by your "temp dir" actions. Besides that I would check the event log or similar to get a glue about a possible different setting of the three server. Best of luck 🤞 . Best regards Sven Edited January 6, 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 6, 2023 Share Posted January 6, 2023 Please also double check: Quote [...] "args":["user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\" [...] Best regardsSven 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 6, 2023 Author Share Posted January 6, 2023 33 minutes ago, SkysLastChance said: Webdriver UDF: 0.10.1 (Update status unknown [1]) WinHTTP: 1.6.4.1 (Download latest source at <https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3>) You should update both of these. Quote cannot create temp dir for unpacking extensions Enter the following from the Windows' command prompt -- echo %temp% Make sure that it points to a directory that exists. SkysLastChance 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
SkysLastChance Posted January 6, 2023 Share Posted January 6, 2023 echo %temp% showed my problem it had a "2" folder it was trying to post into. I created the folder in the directory and Bingo. You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott Link to comment Share on other sites More sharing options...
Danp2 Posted January 7, 2023 Author Share Posted January 7, 2023 (edited) On 1/6/2023 at 3:16 PM, SkysLastChance said: ;Finds a avalible port if running on RDC (Remote Desktop Computer) This is needed if multiple users are running a script on the server at the same time. ;Starts at 9515 and +1 after FYI, I wrote a function to handle this when I was previously working on the webdriver BiDi implementation. I just submitted this PR, which adds _WD_GetFreePort to wd_helper. Feel free to test and provide feedback. Also, do you think it would be good to have it default to a predefined range if the min/max values aren't supplied? Edit: This has been merged into the main branch and will be included in the next release. Edited January 9, 2023 by Danp2 mLipok and SkysLastChance 2 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) I try to get how many line/row in a table. Firstly, i use _WD_GetTable. My code: $aTable = _WD_GetTable($sSession, '//table[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_formExtenderPKOrderForm_FormGridd101_gridTable"]') _ArrayDisplay($aTable) My element: <table id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_gridTable" class="GridTable" cellpadding="0" cellspacing="0"> From Consol: __WD_Post ==> No match [8] : HTTP status = 404 _WD_FindElement ==> No match [8] : Parameters: Strategy=xpath Selector=//table[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_formExtenderPKOrderForm_FormGridd101_gridTable"] StartNodeID=Default Multiple=Default ShadowRoot=Default _WD_GetTable ==> No match [8] The question is: ; Parameters ....: $sSession - Session ID from _WD_CreateSession ; $sBaseElement - XPath of the table to return is $sBaseElement = '//table[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_formExtenderPKOrderForm_FormGridd101_gridTable"] ' i'm i right? 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 @iSanYes.. I can only assume that your xpath is wrong since the attempt to locate the table fails. Of course, it could be a more complex issue such as frames. 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 So, any other way to get how many line/row in a table? Tryed FindElement with "//tr" but there are so many //tr in the web SOLVE-SMART 1 Link to comment Share on other sites More sharing options...
Danp2 Posted January 8, 2023 Author Share Posted January 8, 2023 @iSanYou could use the $sStartNodeID parameter of _WD_FindElement, which would allow you to retrieve only elements associated with the designated starting node. However, this would still require you to resolve the issue we discussed above where the table can't be located. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
mLipok Posted January 8, 2023 Share Posted January 8, 2023 26 minutes ago, Danp2 said: Of course, it could be a more complex issue such as frames. 21 minutes ago, iSan said: So, any other way to get how many line/row in a table? start with: _WD_FrameList() iSan and SOLVE-SMART 2 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 Code * for 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 API * ErrorLog.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 TaskScheduler * IE 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 stuff * OnHungApp handler * Avoid "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" , 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 More sharing options...
Danp2 Posted January 8, 2023 Author Share Posted January 8, 2023 3 minutes ago, mLipok said: start with: _WD_FrameList() A better option would be to learn to use the browser's Dev Tools. Being proficient with them and you can more easily determine things like xpath, frame usage, etc. 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) Yea, i think for this web, we can't locate Table. I have Element of first Line in this table: <tr id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_gridRow1" class="RowCellDefault" onmouseover="Sys.UI.DomElement.addCssClass(this, "Highlight");$find("ctl00_FastBusiness_MainReport_dirExtender_FormGridd98")._highlightItem(this, 0);" onmouseout="Sys.UI.DomElement.removeCssClass(this, "Highlight");$find("ctl00_FastBusiness_MainReport_dirExtender_FormGridd98")._highlightItem(this, 1);">...</tr> You can see the first id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_gridRow1" So, id of lines in this table are numbered in sequence, any way to solve it? Quote start with: _WD_FrameList() @mLipok i will take a look at this. Edited January 8, 2023 by iSan Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted January 8, 2023 Share Posted January 8, 2023 (edited) Hi @iSan, I thought we already discussed this and solve it too, regarding counting table row elements 🧐 ?! Please see this post. Again: Global Const $sSelector = '//table[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_gridTable"]//tr' MsgBox('', 'Count of found elements', _GetElementsCount($sSelector)) Func _FindElements($sSelector) Return _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sSelector, Default, True) EndFunc Func _GetElementsCount($sSelector) Return UBound(_FindElements($sSelector)) EndFunc This should work if your posted table element ID is correct. Best regards Sven Edited January 8, 2023 by SOLVE-SMART 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...
Danp2 Posted January 8, 2023 Author Share Posted January 8, 2023 1 hour ago, iSan said: My code: $aTable = _WD_GetTable($sSession, '//table[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_formExtenderPKOrderForm_FormGridd101_gridTable"]') _ArrayDisplay($aTable) My element: <table id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_gridTable" class="GridTable" cellpadding="0" cellspacing="0"> Looking at this again, the element ID you used in the xpath in _WD_GetTable is different from the element ID shown for the table above. This would explain why it wasn't found. 🙄 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) Hi @Danp2, yes, exactly 👍 . That's why I provided the "correct" ID in my post above. But still, it's pure guessing until @iSan try to help us with proper information and following some recommendation of how to post your problem 🤨 . 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...
iSan Posted January 8, 2023 Share Posted January 8, 2023 (edited) 1 hour ago, Danp2 said: Looking at this again, the element ID you used in the xpath in _WD_GetTable is different from the element ID shown for the table above. This would explain why it wasn't found. 🙄 @Danp2 My bad. I tryed some other ID,that was the last ID i changed, i did that many times until i get stuck, then i put that ID in my question without checking. @SOLVE-SMARTGreatful that FindElement with that id success, but only return 1 value. '//table[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_gridTable"]//tr' And i saw in Func _WD_GetTable of wd_helper.au3 that the id of extended xpath lack a / before tbody and tr right? $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sBaseElement & "/tbody/tr", "", True) ; Retrieve the number of table rows Edited January 8, 2023 by iSan Link to comment Share on other sites More sharing options...
Recommended Posts