mLipok Posted July 17, 2023 Share Posted July 17, 2023 (edited) 13 hours ago, Fred93 said: 2 with a "classic" launch (at least as i understand it...) and 2 with the "existing window" mode. https://www.autoitscript.com/wiki/WebDriver#FAQ Edited July 17, 2023 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 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...
Fred93 Posted July 18, 2023 Share Posted July 18, 2023 thx @Danp2 and @mLipok i'm not sure i explained my problem correctly. In fact, i succeeded to attach to an existing firefox instance. (thanks to your examples) i launch webdriver with _WD_Option('DriverParams', '--log trace --marionette-port 2828') then i navigate to my url, do some things. then shutdown the driver with WD_shutdown() Next, i launch again with : _WD_Option('DriverParams', '--log trace --marionette-port 2828 --connect-existing') and i can attach to my previously launched firefox instance. Everything is ok. But from the moment i used --marionette-port 2828, there is no turning back. it will use always the same firefox instance, and i don't want that (i need to open several URL in several windows, that's why in my previously post i made the testWD.au3. If you click on the first 2 buttons, it will launch a firefox window as many times as you click on the button (for me, it's the "normal mode"). But when you click on "existing window mode" buttons, "normal mode" buttons don't work as expected... at least, as they used to before pressing "existing window" buttons. Link to comment Share on other sites More sharing options...
mLipok Posted July 18, 2023 Share Posted July 18, 2023 2 hours ago, Fred93 said: (i need to open several URL in several windows, but why not in one Browser but in separate TABS ? 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...
Fred93 Posted July 18, 2023 Share Posted July 18, 2023 (edited) 7 minutes ago, mLipok said: but why not in one Browser but in separate TABS ? Because i open some web apps that require one browser each, without tabs. Edited July 18, 2023 by Fred93 Link to comment Share on other sites More sharing options...
mLipok Posted July 18, 2023 Share Posted July 18, 2023 (edited) 51 minutes ago, Fred93 said: some web apps that require one browser each, without tabs. I'm not an expert in creating website/portals, so I may be a layman here, but... I have never encountered such a requirement. I didn't even know this possibility existed. Unless you mean clicking on the link opens a separate window. Edited July 18, 2023 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 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...
bdr529 Posted July 18, 2023 Share Posted July 18, 2023 I apologise in advance for my poor/bad English I use google translate please look at the attached file Func _WD_GetTable with _HtmlTable2Array.au3 = the data is acquired slowly look at the example and the proposed solution #include "wd_helper.au3" #include "wd_capabilities.au3" #include <_HtmlTable2Array.au3> #include <IE.au3> $_WD_DEBUG=$_WD_DEBUG_None _WD_Option("errormsgbox", (@Compiled = 1)) _WD_Option("OutputDebug", (@Compiled = 1)) local $sCapabilities=SetupGecko("") _WD_Startup() local $_WD_CreateSession=_WD_CreateSession($sCapabilities) local $url="file:///"&stringreplace(@scriptdir&"\table.html","\","/") _WD_Navigate($_WD_CreateSession,$url) _WD_LoadWait($_WD_CreateSession) local $hTimer,$TimerDiff $hTimer = TimerInit() _WD_GetTable($_WD_CreateSession, "//table") $TimerDiff=TimerDiff($hTimer)/1000 consolewrite(@crlf&"second : "&$TimerDiff&@crlf) ; ~ second : 23.6025399 ;~ the data is acquired slowly ;~ do you like this solution? $hTimer = TimerInit() $Shell_Explorer_2_GUICreate=GUICreate("") $oIE_se2=ObjCreate("Shell.Explorer.2") GUICtrlCreateObj($oIE_se2,0,0) _ienavigate($oIE_se2,"about:blank") local $html=_WD_ExecuteScript($_WD_CreateSession,'return document.documentElement.outerHTML',Default,Default, $_WD_JSON_Value) _IEDocWriteHTML($oIE_se2,$html) local $oTable=_IETableGetCollection($oIE_se2,0) local $table=_IETableWriteToArray($oTable,true) $TimerDiff=TimerDiff($hTimer)/1000 consolewrite(@crlf&"second : "&$TimerDiff&@crlf) ; ~ second : 0.4618603 _WD_DeleteSession($_WD_CreateSession) _WD_Shutdown() table.html To community goes all my regards and thanks Link to comment Share on other sites More sharing options...
Fred93 Posted July 18, 2023 Share Posted July 18, 2023 39 minutes ago, mLipok said: Unless you mean clicking on the link opens a separate window. yeah this is what i mean, it's not a "requirement". These app go on a separate window when i click on the link, u can't type in the adress bar, and in the past, with IE, i tried to launch them in tabs, but didn't work, some weirds session issues. Link to comment Share on other sites More sharing options...
Danp2 Posted July 18, 2023 Author Share Posted July 18, 2023 @bdr529 Your results are impressive, but I don't particularly like the solution due to the inclusion of IE.au3. I noticed that _WD_GetTable without _HtmlTable2Array.au3 fails to retrieve the table's contents, so that will require further research to understand why. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
bdr529 Posted July 18, 2023 Share Posted July 18, 2023 (edited) 2 hours ago, Danp2 said: @bdr529I tuoi risultati sono impressionanti, ma non mi piace particolarmente la soluzione a causa dell'inclusione di IE.au3. Ho notato che _WD_GetTable senza _HtmlTable2Array.au3 non riesce a recuperare il contenuto della tabella, quindi richiederà ulteriori ricerche per capire perché. $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sBaseElement & "/tbody/tr[1]/td", "", True) ; Retrieve the number of table columns by checking the first table row ko [1] /td ok [1]/th or [2]/td Edited July 18, 2023 by bdr529 To community goes all my regards and thanks Link to comment Share on other sites More sharing options...
seadoggie01 Posted July 18, 2023 Share Posted July 18, 2023 If you have a "basic" table that you want to extract quickly, you could probably use a bit of JavaScript to build a pipe and newline delimited table. See _WD_ExecuteScript and use something similar to this script: // Accepts an HtmlElement currently for ease in testing. Modify to accept an XPath/Id? function tableExport(table){ var tbody = table.getElementsByTagName("tbody")[0]; var text = ""; // For each row for(let row of tbody.getElementsByTagName("tr")){ // For each cell in the row for(let cell of row.getElementsByTagName("td")){ // Note .innerText might not be what you want here, modify as needed text += cell.innerText + "|"; } text = text.slice(0, -1) + '\n'; } return text.slice(0, -1); } mLipok 1 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 functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
Danp2 Posted July 18, 2023 Author Share Posted July 18, 2023 (edited) @bdr529 I was just looking at this earlier. //table//tr[1]/* seems to work for both scenarios, but it might be good to only include td or th elements. Edit: This is what I plan to use going forward -- //table/tbody/tr[1]/*[self::td or self::th] Edited July 18, 2023 by Danp2 bdr529 and mLipok 1 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
CYCho Posted July 19, 2023 Share Posted July 19, 2023 (edited) For your information, the latest chrome.exe(115.0.5790.99) produces its version number as 114.0.5735.90 when querried with chrome.exe --version. I replaced my chromedriver.exe with 115.0.5790.98 anyway and it works. I did not test the compatibility with old version of chromedriver.exe. Edit: I was confused. There is no problem. Edited July 19, 2023 by CYCho zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
Danp2 Posted July 19, 2023 Author Share Posted July 19, 2023 @CYCho I'm confused. Did you mean Chromedriver? CYCho 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
CYCho Posted July 19, 2023 Share Posted July 19, 2023 (edited) No, I mean Chrome.exe. Edit: I was really confused. There is no problem. Edited July 19, 2023 by CYCho zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
CYCho Posted July 19, 2023 Share Posted July 19, 2023 My confusion was caused by the change in the way Google packs chromedriver.exe in chromedriver_win32.zip file. In the new version, the zip file contains a folder(chromedriver-win32), mind the hyphen instead of underscore, wherein chromedriver.exe is packed. So unpacking the zip file will copy only the folder, requiring an additional step to copy the folder's contents to webdriver folder. zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
Danp2 Posted July 19, 2023 Author Share Posted July 19, 2023 @CYCho OIC. That's good information to know. I will need to review _WD_UpdateDriver to see if its still functions properly given this new layout. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
CYCho Posted July 19, 2023 Share Posted July 19, 2023 (edited) I found that upacking the zip file could be done by including the folder name after the name of zip file . I think wd_helper.au3 already covers this situation. I had problem because I was using an old code of mine to update the chromedriver. $FilesInZip = $oShell.NameSpace($sZipFile & "\chromedriver-win32").items Edited July 19, 2023 by CYCho zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
Erik_NJ Posted July 19, 2023 Share Posted July 19, 2023 The latest version of the UDF (1.1.0) has now a new entry: _VersionCompare(), but, how is it used? any examples? Thanks Link to comment Share on other sites More sharing options...
Danp2 Posted July 19, 2023 Author Share Posted July 19, 2023 @Erik_NJ _VersionCompare() is part of the standard AutoIt UDF package. _WD_IsLatestRelease() was recently changed to use _VersionCompare instead of performing a string comparison. This shouldn't require any change on the user's part. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Jemboy Posted July 19, 2023 Share Posted July 19, 2023 This morning I got on one computer an error updating Chromedriver. My Chrome has been updated to v115. and my Chromedriver is v114. Look on https://chromedriver.chromium.org/downloads only Chromedriver v114 seems to be available. For now other computers somehow don't have this problem (yet), but I dread having to update about 100 computers manually again 😂 My updater code is this: $CDVer = GetCDVersion () ;Get Chromedriver version $ChVer = GetChromeVersion () ;Get Chrome version If $ChVer<>$CDVer Then $lResult = _WD_UpdateDriver('chrome', Default, Default, true ) ;Update Chromedriver $lErr = @error If $lResult=False Then $mText = "Chrome version: " & $ChVer & @CRLF & "Chromedriver version: " & $CDVer & @CRLF & @CRLF $mText = $mText & "Chrome Update Result: " & $lResult & @CRLF & "Update Error: " & $lErr & @CRLF & @CRLF $mText = $mText & "Update fout: neem contact op met ICT afdeling." MsgBox (0,$sTitle,$mText) Exit EndIf EndIf Link to comment Share on other sites More sharing options...
Recommended Posts