Marlon13 Posted April 14, 2021 Posted April 14, 2021 I insert inside at function this code ConsoleWrite($sProfilePath) return this C:/Users/Marlon/AppData/Roaming/Mozilla/Firefox/Profiles/eclfg9se.default so either replaced the function with the correct path for me Global $sGPathProfileBrowser = "C:\Users\Marlon\AppData\Roaming\Mozilla\Firefox\Profiles\fechpd3a.default-release"
Marlon13 Posted April 14, 2021 Posted April 14, 2021 the dam slash yea in this mode work thanks again C:/Users/Marlon/AppData/Roaming/Mozilla/Firefox/Profiles/fechpd3a.default-release
Marlon13 Posted April 14, 2021 Posted April 14, 2021 sorry again after closing the browser and restarting the browser normally without the script it gives me the icon of the robot in the address bar as if I had opened it with gekodriver? why? thanks again sorry for the inconveniencesorry again after closing the browser and restarting the browser normally without the script it gives me the icon of the robot in the address bar as if I had opened it with gekodriver? why? thanks again sorry for the inconvenience
Danp2 Posted April 14, 2021 Author Posted April 14, 2021 22 minutes ago, Marlon13 said: the dam slash yea in this mode work thanks again C:/Users/Marlon/AppData/Roaming/Mozilla/Firefox/Profiles/fechpd3a.default-release That's curious because you previously stated that this didn't work for you. 🤨 Quote after closing the browser and restarting the browser normally without the script it gives me the icon of the robot in the address bar Probably resulted in the following setting being set to True in the profile -- marionette.enabled You can check by going to "about:config" and reviewing the setting. Latest Webdriver UDF Release Webdriver Wiki FAQs
Marlon13 Posted April 14, 2021 Posted April 14, 2021 30 minutes ago, Danp2 said: That's curious because you previously stated that this didn't work for you. 🤨 I modify your script , in your script work in my no, now I look why thanks again again
Marlon13 Posted April 14, 2021 Posted April 14, 2021 WRONG -> ;$sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile ", ' & $sGPathProfileBrowser & '],"log": {"level": "trace"}}}}}' CORRECT -> $sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "' & $sGPathProfileBrowser & '"],"log": {"level": "trace"}}}}}' the strange thing is that I had copied from the wiki, but now I see that in the wiki it is as you wrote it, strange because I had only changed the function in the variable bha
Danp2 Posted April 14, 2021 Author Posted April 14, 2021 @Marlon13 That's because I updated the wiki to fix the missing quotation marks. 😄 Latest Webdriver UDF Release Webdriver Wiki FAQs
Marlon13 Posted April 14, 2021 Posted April 14, 2021 I know I'm becoming your nightmare sorry (be patient) I noticed that if I insert this call _WD_Navigate($sSession, "https://www.myfxbook.com/forex-economic-calendar") into an function it no longer opens the address but instead opens the browser default page o_O expandcollapse popup#include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <File.au3> #include <Array.au3> #include "wd_core.au3" #include "wd_helper.au3" #include <GuiComboBoxEx.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> Global $sDesiredCapabilities, $sSession Global $sGPathProfileBrowser = "C:/Users/Marlon/AppData/Roaming/Mozilla/Firefox/Profiles/fechpd3a.default-release" SetupGecko(1) _WD_Startup() If @error <> $_WD_ERROR_Success Then Exit -1 EndIf $sSession = _WD_CreateSession($sDesiredCapabilities) _ScrapeEconCalendar() MsgBox(0, "", "") _WD_DeleteSession($sSession) _WD_Shutdown() Func _ScrapeEconCalendar() _WD_Navigate($sSession, "https://www.myfxbook.com/forex-economic-calendar") #cs ;_WD_Attach($sSession, "myfxbook.com", "URL") MsgBox(0, "", "") $sElement = _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@role='button']") If @error = $_WD_ERROR_Success Then _WD_ElementAction($sSession, $sElement, 'click') ;_WD_ElementAction($sSession, $sElement, 'value', $sGMail) EndIf #ce EndFunc ;==>_ScrapeEconCalendar Func SetupGecko($iNewOldBrowser) If $iNewOldBrowser = 0 Then _WD_Option('Driver', 'geckodriver.exe') _WD_Option('DriverParams', '--log trace') _WD_Option('Port', 4444) $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"browserName": "firefox", "acceptInsecureCerts":true}}}' Else _WD_Option('Driver', 'geckodriver.exe') _WD_Option('DriverParams', '--log trace') _WD_Option('Port', 4444) $sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "' & $sGPathProfileBrowser & '"],"log": {"level": "trace"}}}}}' EndIf EndFunc ;==>SetupGecko
mLipok Posted April 14, 2021 Posted April 14, 2021 (edited) On 4/14/2021 at 7:26 PM, Danp2 said: @mLipok That's an issue with your local installation. As indicated in the error message, it can't find FF in the default location. Therefore, it's up to you to provide the proper details to geckodriver so that it can launch FF. The problem was related to the fact that my standard FFx32 was broken. I download FF form main site, but I not notice that this was FFx64 version. After uninstalig x64 and reinstaling x32 all start to works. I mean: $sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "' & GetDefaultFFProfile() & '"],"log": {"level": "trace"}}}}}' Works properly. But I found and try to use: in such a way: Func SetupGecko() _WD_Option('Driver', 'geckodriver_32.exe') Local $s_FireFox_exe = ' --binary C:\Program Files (x86)\Mozilla Firefox\firefox.exe' _WD_Option('DriverParams', '--log trace --marionette-port 2828' & $s_FireFox_exe) _WD_Option('Port', 4444) $sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "' & GetDefaultFFProfile() & '"],"log": {"level": "trace"}}}}}' .... .... .... .... With no success. How I can manually specify location of firefox.exe ?.... or What I'm doing wrong with "--binary" ? Edited February 3, 2022 by mLipok typo 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
Danp2 Posted April 14, 2021 Author Posted April 14, 2021 @mLipok You can do it as part of the DesiredCapabilities string -- $sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"binary":"C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe", "args": ["-profile", "' & GetDefaultFFProfile() & '"],"log": {"level": "trace"}}}}}' mLipok 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
mLipok Posted April 14, 2021 Posted April 14, 2021 (edited) after using this snippet: Local $s_FireFox_exe = StringReplace('C:\Program Files (x86)\Mozilla Firefox\firefox.exe','\', '\\') $sDesiredCapabilities = '{"capabilities":{"alwaysMatch":{"moz:firefoxOptions":{"binary":"' & $s_FireFox_exe & '", "args": ["-profile", "' & GetDefaultFFProfile() & '"],"log": {"level": "trace"}}}}}' It works well. Thanks @Danp2 Edited April 14, 2021 by mLipok Danp2 1 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
Danp2 Posted April 14, 2021 Author Posted April 14, 2021 @Marlon13 You missed one minor detail. You must alter the line _WD_Option('DriverParams', '--log trace') to include some additional instructions to tell geckdriver the correct port to use. The modified line should look like this -- _WD_Option('DriverParams', '--log trace --marionette-port 2828') Marlon13 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
mLipok Posted April 14, 2021 Posted April 14, 2021 (edited) Spoiler No I do not miss them. Just show my solution (based on your answer) to this example: 3 hours ago, mLipok said: in such a way: Func SetupGecko() _WD_Option('Driver', 'geckodriver_32.exe') Local $s_FireFox_exe = ' --binary C:\Program Files (x86)\Mozilla Firefox\firefox.exe' _WD_Option('DriverParams', '--log trace --marionette-port 2828' & $s_FireFox_exe) _WD_Option('Port', 4444) $sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "' & GetDefaultFFProfile() & '"],"log": {"level": "trace"}}}}}' .... .... .... .... With no success. But yeah. Finally this code should look like this: Func SetupGecko() _WD_Option('Driver', 'geckodriver_32.exe') _WD_Option('DriverParams', '--log trace --marionette-port 2828') _WD_Option('Port', 4444) Local $s_FireFox_exe = StringReplace('C:\Program Files (x86)\Mozilla Firefox\firefox.exe','\', '\\') $sDesiredCapabilities = '{"capabilities":{"alwaysMatch":{"moz:firefoxOptions":{"binary":"' & $s_FireFox_exe & '", "args": ["-profile", "' & GetDefaultFFProfile() & '"],"log": {"level": "trace"}}}}}' EndFunc ;==>SetupGecko Edited April 14, 2021 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
Danp2 Posted April 14, 2021 Author Posted April 14, 2021 55 minutes ago, mLipok said: No I do not miss them. If you go back and reread my post, you'll see that it wasn't directed at you. 😛 mLipok 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
mLipok Posted April 14, 2021 Posted April 14, 2021 (edited) 16 minutes ago, Danp2 said: If you go back and reread my post, you'll see that it wasn't directed at you. 😛 So I hide my mistake Edited April 14, 2021 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
mLipok Posted April 15, 2021 Posted April 15, 2021 (edited) What you think about such concept: expandcollapse popup#include "wd_core.au3" #include "wd_helper.au3" Global $_WD_My_Session _Example() Func _Example() Local $sDesiredCapabilities = SetupGecko() _WD_Startup() $_WD_My_Session = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($_WD_My_Session, "https://facebook.com") MsgBox(0, "Pause", "") _WD_DeleteSession($_WD_My_Session) _WD_Shutdown() EndFunc ;==>_Example Func SetupGecko() _WD_Option('Driver', 'geckodriver_32.exe') _WD_Option('DriverParams', '--log trace --marionette-port 2828') _WD_Option('Port', 4444) Local $Obj _WD_Capabilites_firefoxOptions_binary($Obj, 'C:\Program Files (x86)\Mozilla Firefox\firefox.exe') _WD_Capabilites_firefoxOptions_args($Obj, '-profile', 'C:\Users\agatk\AppData\Roaming\Mozilla\Firefox\Profiles\5819ktj7.default') _WD_Capabilites_firefoxOptions_log_level($Obj, 'trace') Local $sDesiredCapabilities = Json_Encode($Obj, $JSON_UNESCAPED_SLASHES) ConsoleWrite('> Test3 Result: ' & @LF & $sDesiredCapabilities & @LF) Return $sDesiredCapabilities EndFunc ;==>SetupGecko Func _WD_Capabilites_firefoxOptions_args(ByRef $Obj, $key, $value) If $key = '-profile' Then $value = StringReplace($value, '\', '/') Json_Put($Obj, '[capabilities][alwaysMatch]["moz:firefoxOptions"][args][0]', $key) Json_Put($Obj, '[capabilities][alwaysMatch]["moz:firefoxOptions"][args][1]', $value) EndFunc ;==>_WD_Capabilites_firefoxOptions_args Func _WD_Capabilites_firefoxOptions_binary(ByRef $Obj, $value) ;~ $value = StringReplace($value, '\', '\\') Json_Put($Obj, '[capabilities][alwaysMatch]["moz:firefoxOptions"][binary]', $value) EndFunc ;==>_WD_Capabilites_firefoxOptions_binary Func _WD_Capabilites_firefoxOptions_log_level(ByRef $Obj, $value) Json_Put($Obj, '[capabilities][alwaysMatch]["moz:firefoxOptions"][log][level]', $value) EndFunc ;==>_WD_Capabilites_firefoxOptions_log_level Edited April 15, 2021 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
Danp2 Posted April 15, 2021 Author Posted April 15, 2021 2 hours ago, mLipok said: What you think about such concept I've thought about doing something similar as a "helper" function. You may want to review how they do it with Selenium. Latest Webdriver UDF Release Webdriver Wiki FAQs
mLipok Posted April 15, 2021 Posted April 15, 2021 (edited) 4 hours ago, Danp2 said: You may want to review how they do it with Selenium. Please provide link or example snippet. EDIT: Is this link and this snippet below what you thought ? Quote Python caps = webdriver.DesiredCapabilities.CHROME.copy() caps['acceptInsecureCerts'] = True driver = webdriver.Chrome(desired_capabilities=caps) example snippet form: https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities Edited April 15, 2021 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
Danp2 Posted April 15, 2021 Author Posted April 15, 2021 @mLipok Yes. Other examples can be found here. Ideally, the solution would be a generic "builder" for the Desired Capabilities that wouldn't require a separate function for each "action". Latest Webdriver UDF Release Webdriver Wiki FAQs
Recommended Posts