# wd_capabilities.au3 - support topic - early BETA version - Work In Progress

## Recommended Posts

Recently I start wd_capabilities.au3 project on my side.
I think this is time to share to AutoIt community.

Check attached UDF: wd_capabilities.au3

Here is a scratch example showing how to use them:

#include "wd_helper.au3"
#include "wd_capabilities.au3"

_Example()

Func _Example()
........
........
........
_WD_Capabilities_Build_Arguments(Null) ; CLEANUP ARGS
_WD_Capabilities_Build_Arguments('start-maximized')
_WD_Capabilities_Build_Arguments('disable-infobars')
Local $s_WD_Capabilities_Arguments = _WD_Capabilities_Build_Arguments(Default) ; GET ARGS _WD_Capabilities_Build_Preferences(Null) ; CLEANUP PREFS If$s_Download_dir Then _WD_Capabilities_Build_Preferences('download.default_directory', $s_Download_dir) Local$s_WD_Capabilities_Preferences = _WD_Capabilities_Build_Preferences(Default) ; GET PREFS

Local $s_Desired_Capabilities = _WD_Capabilities_Build_JSON('chrome',$s_WD_Capabilities_Arguments, $s_WD_Capabilities_Preferences) Local$WD_SESSION = _WD_CreateSession($s_Desired_Capabilities) ........ ........ ........ EndFunc I plan to publish the code on GitHub. In the indefinite future, when the project becomes more functional, if @Danp2 accepts it, I hope it may be included in the main WebDriver UDF. I am waiting for yours feedback and help in the further development of this project. REMARK 1: As so far this UDF only supports GoogleChrome. Adding support for other browsers shouldn't be difficult, I just didn't need to. REMARK 2: For now, this project is working but still as a early BETA, so please do not discuss, ask questions, or post examples or snippets of code that pertain to any function of this UDF in other part of this forum, until it is found acceptable. Simply: discusion and tests only here in this topic. Regards, @mLipok Edited by mLipok wordings, some code improvements Signature beginning: Please remember: "AutoIt"..... Wondering who uses AutoIt and what it can be used for ? * Include Dependency Tree (Tool for analyzing script relations) How to use IE.au3 UDF with AutoIt v3.3.14.x 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 to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane 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 "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: 2021-03-17 ##### Link to post ##### Share on other sites • Replies 91 • Created • Last Reply #### Top Posters In This Topic #### Top Posters In This Topic #### Popular Posts Just my 2 cents worth. Somewhere in this thread you say that your WD Capabilities UDF should become part of the WebDriver UDF. In this case, I would strongly recommend using the WebDriver UDF n Just for fun: Saludos New version: #include "wd_helper.au3" #include "wd_capabilities.au3" _Example() Exit Func _Example() If$IDYES = MsgBox($MB_YESNO +$MB_TOPMOST + $MB_ICONQ #### Posted Images I found this example: { "capabilities": { "alwaysMatch": { "browserName": "firefox", "moz:firefoxOptions": { "profile": "<base64 encoded profile>", "args": ["-headless"], "prefs": {"dom.ipc.processCount": 8}, "log":{"level": "trace"} } }, "firstMatch": [ {"platformName": "macos"}, {"platformName": "linux"} ] } } My question is: Do we need a feature to combine alwaysMatch and firstMatch ? Signature beginning: Please remember: "AutoIt"..... Wondering who uses AutoIt and what it can be used for ? * Include Dependency Tree (Tool for analyzing script relations) How to use IE.au3 UDF with AutoIt v3.3.14.x 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 to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane 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 "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: 2021-03-17 ##### Link to post ##### Share on other sites I'm not sure about If It's required or no. But Maybe you can deduct it reading this. Saludos AutoIt... ##### Link to post ##### Share on other sites 40 minutes ago, mLipok said: Do we need a feature to combine alwaysMatch and firstMatch ? My vote is no. 😉 ##### Link to post ##### Share on other sites 3 minutes ago, Danyfirex said: But Maybe you can deduct it reading this. Nice findings. Signature beginning: Please remember: "AutoIt"..... Wondering who uses AutoIt and what it can be used for ? * Include Dependency Tree (Tool for analyzing script relations) How to use IE.au3 UDF with AutoIt v3.3.14.x 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 to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane 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 "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: 2021-03-17 ##### Link to post ##### Share on other sites 1 minute ago, Danp2 said: My vote is no. 😉 Ok. Do we need alwaysMatch or firstMatch but separately ? I mean do we need a feature to choose between them ? Signature beginning: Please remember: "AutoIt"..... Wondering who uses AutoIt and what it can be used for ? * Include Dependency Tree (Tool for analyzing script relations) How to use IE.au3 UDF with AutoIt v3.3.14.x 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 to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane 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 "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: 2021-03-17 ##### Link to post ##### Share on other sites Yes, I would recommend support for both options since that's in line with the W3C specs. ##### Link to post ##### Share on other sites Which one should be default for WD UDF ? Signature beginning: Please remember: "AutoIt"..... Wondering who uses AutoIt and what it can be used for ? * Include Dependency Tree (Tool for analyzing script relations) How to use IE.au3 UDF with AutoIt v3.3.14.x 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 to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane 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 "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: 2021-03-17 ##### Link to post ##### Share on other sites alwaysMatch I think. AutoIt... ##### Link to post ##### Share on other sites I did a lot of further work on this project. Currently, the example looks like this: #include "wd_helper.au3" #include "wd_capabilities.au3" _Example() Func _Example() ........ ........ ........ _WD_Capabilities_BrowserSpecific_AddArgument(Null) ; CLEANUP ARGS ;~ _WD_Capabilities_BrowserSpecific_AddArgument('--headless') _WD_Capabilities_BrowserSpecific_AddArgument('start-maximized') _WD_Capabilities_BrowserSpecific_AddArgument('disable-infobars') _WD_Capabilities_BrowserSpecific_AddArgument('user-data-dir', 'C:\Users\' & @UserName & '\AppData\Local\Google\Chrome\User Data\Default') Local$s_WD_Capabilities_Arguments = _WD_Capabilities_BrowserSpecific_AddArgument(Default) ; GET ARGS

If $s_Download_dir Then _WD_Capabilities_BrowserSpecific_AddPreference('download.default_directory',$s_Download_dir)
Local $s_WD_Capabilities_Preferences = _WD_Capabilities_BrowserSpecific_AddPreference(Default) ; GET PREFS _WD_Capabilities_BrowserSpecific_AddLog(Null) ; CLEANUP LOGS Local$s_WD_Capabilities_BrowserSpecific_Logs = _WD_Capabilities_BrowserSpecific_AddLog(Default) ; GET LOGS

Local $s_WD_Capabilities_BrowserSpecific_Envs = _WD_Capabilities_BrowserSpecific_AddEnv(Default) ; GET ENVS Local$s_Desired_Capabilities = _WD_Capabilities_Build_JSON('chrome', '', $s_WD_Capabilities_BrowserSpecific_Arguments,$s_WD_Capabilities_BrowserSpecific_Preferences, $s_WD_Capabilities_BrowserSpecific_Logs,$s_WD_Capabilities_BrowserSpecific_Envs)

Local $WD_SESSION = _WD_CreateSession($s_Desired_Capabilities)
........
........
........
EndFunc   ;==>_Example

This should give a picture of the direction of change.

Signature beginning:
Please remember: "AutoIt".....  Wondering who uses AutoIt and what it can be used for ?
*
Include Dependency Tree (Tool for analyzing script relations)
How to use IE.au3  UDF with  AutoIt v3.3.14.x  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 to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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

"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: 2021-03-17

##### Share on other sites

wouldn't  it be possible to make it easier? I don't know but your suggested UDF seems to be complex for me. I also notice it could be ambiguous  to use _Add as a getter passing default as parameter.

Saludos

AutoIt...

##### Share on other sites

I wonder if it would make more sense to provide a GUI interface that can be used to generate the Capabilities string. I've found a couple of web-based examples --

##### Share on other sites

For now I have such example:

Func _Example_Chrome()

Local $s_Desired_Capabilities = _WD_Capabilities_Build_JSON('chrome') _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Startup() Local$WD_SESSION = _WD_CreateSession($s_Desired_Capabilities) #forceref$WD_SESSION
MsgBox($MB_OK +$MB_TOPMOST + $MB_ICONINFORMATION, "Information #" & @ScriptLineNumber, "Waiting for close") _WD_Shutdown() EndFunc ;==>_Example_Chrome I plan to remove the requirment of MANUALY CLEANUP. @Danyfirex Is this what you thought about? Signature beginning: Please remember: "AutoIt"..... Wondering who uses AutoIt and what it can be used for ? * Include Dependency Tree (Tool for analyzing script relations) How to use IE.au3 UDF with AutoIt v3.3.14.x 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 to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane 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 "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: 2021-03-17 ##### Link to post ##### Share on other sites Yes It's ok, What's the purpose of that long name _WD_Capabilities_BrowserSpecific_AddPreference? what about using a shorter name like _WD_Capabilities_AddPreference ,_WD_Capabilities_AddArgument Saludos AutoIt... ##### Link to post ##### Share on other sites 14 minutes ago, Danyfirex said: What's the purpose of that long name _WD_Capabilities_BrowserSpecific_AddPreference? It refers to the place where it is in WD and JSON If AutoIt will be fully objective language I will do this like this: ....$oWD_Capabilities.BrowserSpecific.AddPreference('download.default_directory', @ScriptDir)
....
Local $s_Desired_Capabilities =$oWD_Capabilities.Build_JSON()
....

btw.
I hope this is possible with some kind of magical AutoIt coding technique.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt".....  Wondering who uses AutoIt and what it can be used for ?
*
Include Dependency Tree (Tool for analyzing script relations)
How to use IE.au3  UDF with  AutoIt v3.3.14.x  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 to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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

"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: 2021-03-17

##### Share on other sites
20 minutes ago, Danyfirex said:

Could be changed. Waiting for other users/members opinion ....

Edited by mLipok

Signature beginning:
Please remember: "AutoIt".....  Wondering who uses AutoIt and what it can be used for ?
*
Include Dependency Tree (Tool for analyzing script relations)
How to use IE.au3  UDF with  AutoIt v3.3.14.x  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 to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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

"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: 2021-03-17

##### Share on other sites
4 hours ago, Danyfirex said:

alwaysMatch I think.

I agree. firstMatch usage could be indicated with an optional parameter.

I also agree that removing "BrowserSpecific" from the function name would be preferred.

##### Share on other sites
1 hour ago, mLipok said:

I hope this is possible with some kind of magical AutoIt coding technique

AKA maps 😃

##### Share on other sites

New version:

#include "wd_helper.au3"
#include "wd_capabilities.au3"
_Example()
Exit

Func _Example()
If $IDYES = MsgBox($MB_YESNO + $MB_TOPMOST +$MB_ICONQUESTION + $MB_DEFBUTTON1, "Question", _ "Do you want to test with running browsers ?") Then Local$b_Headless = ($IDYES = MsgBox($MB_YESNO + $MB_TOPMOST +$MB_ICONQUESTION + $MB_DEFBUTTON1, "Question", "Do you want to test with headless mode ?")) _Example_Chrome(True,$b_Headless)
_Example_FireFox(True, $b_Headless) Else ; only show$s_Desired_Capabilities in console
_Example_Chrome(False)
_Example_FireFox(False)
EndIf
EndFunc   ;==>_Example

Func _Example_Chrome($b_Run_Browser,$b_Headless = False)
_WD_Capabilities_Startup()
If $b_Headless Then _ _WD_Capabilities_AddArgument('--headless') _WD_Capabilities_AddArgument('start-maximized') _WD_Capabilities_AddArgument('disable-infobars') _WD_Capabilities_AddArgument('user-data-dir', 'C:\Users\' & @UserName & '\AppData\Local\Google\Chrome\User Data\Default') _WD_Capabilities_AddPreference('download.default_directory', @ScriptDir) Local$s_Desired_Capabilities = _WD_Capabilities_Build_JSON('chrome')
If Not $b_Run_Browser Then ConsoleWrite($s_Desired_Capabilities & @CRLF)
ConsoleWrite('=============' & @CRLF)
Return
EndIf

;~  $s_Desired_Capabilities = StringStripCR($s_Desired_Capabilities)
;~  $s_Desired_Capabilities = StringReplace($s_Desired_Capabilities, @TAB, '')
;~  ConsoleWrite($s_Desired_Capabilities & @CRLF) ;~ ConsoleWrite('=============' & @CRLF) _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Startup() Local$WD_SESSION = _WD_CreateSession($s_Desired_Capabilities) MsgBox($MB_OK + $MB_TOPMOST +$MB_ICONINFORMATION, "Information #" & @ScriptLineNumber, "Waiting before _WD_Shutdown()")
_WD_DeleteSession($WD_SESSION) _WD_Shutdown() EndFunc ;==>_Example_Chrome Func _Example_FireFox($b_Run_Browser, $b_Headless = False) _WD_Capabilities_Startup() ;~ _WD_Capabilities_AddOption('browserName', 'firefox') If$b_Headless Then _
Local $s_My_Profile_Dir = 'c:\Users\' & @UserName & '\AppData\Local\Mozilla\Firefox\Profiles\TESTING.default' _WD_Capabilities_AddArgument('-profile') _WD_Capabilities_AddArgument($s_My_Profile_Dir)

_WD_Capabilities_AddEnv('MOZ_LOG_FILE', $s_My_Profile_Dir & '\log') Local$s_Desired_Capabilities = _WD_Capabilities_Build_JSON('firefox')

If Not $b_Run_Browser Then ConsoleWrite($s_Desired_Capabilities & @CRLF)
ConsoleWrite('=============' & @CRLF)

Return
EndIf

;~  $s_Desired_Capabilities = StringStripCR($s_Desired_Capabilities)
;~  $s_Desired_Capabilities = StringReplace($s_Desired_Capabilities, @TAB, '')
;~  ConsoleWrite($s_Desired_Capabilities & @CRLF) ;~ ConsoleWrite('=============' & @CRLF) _WD_Option('Driver', 'geckodriver.exe') _WD_Option('Port', 4444) _WD_Startup() Local$WD_SESSION = _WD_CreateSession($s_Desired_Capabilities) MsgBox($MB_OK + $MB_TOPMOST +$MB_ICONINFORMATION, "Information #" & @ScriptLineNumber, "Waiting before _WD_Shutdown()")
_WD_DeleteSession($WD_SESSION) _WD_Shutdown() EndFunc ;==>_Example_FireFox Edited by mLipok Signature beginning: Please remember: "AutoIt"..... Wondering who uses AutoIt and what it can be used for ? * Include Dependency Tree (Tool for analyzing script relations) How to use IE.au3 UDF with AutoIt v3.3.14.x 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 to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane 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 "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: 2021-03-17 ##### Link to post ##### Share on other sites Did you try the latest version? Is it works for you? Do you have any other requests related to this UDF? REMARK: About feature "firstMatch" ... I have some concept in my mind. But I don't think I would start implementing and testing it earlier than next week. Edited by mLipok Signature beginning: Please remember: "AutoIt"..... Wondering who uses AutoIt and what it can be used for ? * Include Dependency Tree (Tool for analyzing script relations) How to use IE.au3 UDF with AutoIt v3.3.14.x 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 to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane 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 "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: 2021-03-17 ##### Link to post ##### Share on other sites • mLipok changed the title to wd_capabilities.au3 - support topic - early BETA version - Work In Progress ## Create an account or sign in to comment You need to be a member in order to leave a comment ## Create an account Sign up for a new account in our community. It's easy! Register a new account ## Sign in Already have an account? Sign in here. Sign In Now • ### Recently Browsing 0 members No registered users viewing this page. • ### Similar Content • By mLipok Anybody could help with using QueryInterface in AutoIt to embed Microsoft Edge using WebView2 Interface ? Here are links to information/documentation: Image comes from: https://docs.microsoft.com/en-us/microsoft-edge/webview2/media/webview2/whatwebview.png Introduction to Microsoft Edge WebView2 https://docs.microsoft.com/en-us/microsoft-edge/webview2/ Understand WebView2 SDK versions https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/versioning Download: https://developer.microsoft.com/en-US/microsoft-edge/webview2/ https://developer.microsoft.com/en-US/microsoft-edge/webview2/#download-section https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution API Reference: https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/?view=webview2-1.0.622.22 HowTo/Concepts: https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/versioning https://docs.microsoft.com/en-us/microsoft-edge/webview2/gettingstarted/win32 https://docs.microsoft.com/en-us/microsoft-edge/webview2/howto/debug?tabs=devtools https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/security https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/userdatafolder https://mybuild.microsoft.com/sessions/9198aeac-0c8e-4d32-96d1-cbb99a390aa6 Example: https://github.com/MicrosoftEdge/WebView2Samples Related: https://www.essentialobjects.com/Products/WebBrowser/Default.aspx?gclid=CjwKCAiA17P9BRB2EiwAMvwNyMe6UI9VHej-JYDBUoyGDFz40KaaJ_RidY-75Fhr-PHz65sSVC0XlxoC5loQAvD_BwE https://docs.microsoft.com/en-us/microsoft-edge/webview2/howto/webdriver btw. I'm not WindowsApi expert (QueryInterface, C++, DllCall). What I trying to say is: It means that I do not done anything in this regards .... as so far. TIMELINE/ChangeLog: 2020-11-12 - Project propsed by @mLipok 2021-02-03 - First version provided by @LarsJ • By Danp2 Introduction This UDF will allow you to interact with any browser that supports the W3C WebDriver specifications. Supporting multiple browsers via the same code base is now possible with just a few configuration settings. Requirements JSON UDF https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn WinHTTP UDF https://www.autoitscript.com/forum/topic/84133-winhttp-functions/ HtmlTable2Array UDF (optional) https://www.autoitscript.com/forum/topic/167679-read-data-from-html-tables-from-raw-html-source/ WebDriver for desired browser Chrome WebDriver https://sites.google.com/a/chromium.org/chromedriver/downloads FireFox WebDriver https://github.com/mozilla/geckodriver/releases Edge WebDriver https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ Source Code You will always be able to find the latest version in the GitHub Repo Help / Support See the wiki for details on the UDF -- https://www.autoitscript.com/wiki/WebDriver Please post any questions, suggestions or errors in the GH&S thread. https://www.autoitscript.com/forum/topic/205553-webdriver-udf-help-support-iii/ Previous support threads (Closed) https://www.autoitscript.com/forum/topic/192730-webdriver-udf-help-support/ https://www.autoitscript.com/forum/topic/201106-webdriver-udf-help-support-ii/ • By Epulone For a specific requirement the outbound email are managed by an on-prem EDGE server. The EDGE re-write the local on-prem email address with another domain [exposed domain - mx record-]. Everything is working fine but we are having an issue when the internal local users are requesting an invite meeting by Outlook calendar . In that case when the receiver accept the request invite it generate an error "domain not found". In this scenario the EDGE server is not able to rewrite also the calendar MIME request (V-card) header inside the message so when the receiver accepts the request the reply [mechanism] will fails as will be used the email address of the local user [domain not exposed ] and not the external one. I was wondering if Autoit is able to manipulate somehow the invite heade- calendar MIME (V-card))- re-witing the user email. Thanks • By Hermes I have Index.html where it contains a frame with a source "frame1.html". I can select/highlight elements in index.html but unable to select/highlight elements inside the frame with the src "frame1.html", the autoit output is throwing error: __WD_Post: URL=HTTP://127.0.0.1:9515/session/2143396006437be4005db3b84acc1496/element/8be1c3c4-5bb1-42b1-8cde-7954765cbc61/element;$sData={"using":"css selector","value":"frameset:nth-of-type(1)"} __WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\... __WD_Post ==> No match: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"css selector\",\"selector\":\"frameset:nth-of-type(1)\"}\n (Session info: chrome=90.0.4430.212)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00FCE7D3+124883]\n\tOrdinal0 [0x00FCE7B1+124849]\n\tGetHandleVerifier [0x01218688+193832]\n\tGetHandleVerifier [0x0123C478+340760]\n\tGetHandleVerifier [0x012361F1+315537]\n\tGetHandleVerifier [0x012516BA+427354]\n\tGetHandleVerifier [0x01236176+315414]\n\tGetHandleVerifier [0x0125174A+427498]\n\tGetHandleVerifier [0x0125D6EB+476555]\n\tGetHandleVerifier [0x0125154B+426987]\n\tGetHandleVerifier [0x01234FFD+310941]\n\tGetHandleVerifier [0x01235D8E+314414]\n\tGetHandleVerifier [0x01235D19+314297]\n\tGetHandleVerifier [0x012F31EC+1089676]\n\tGetHandleVerifier [0x012F17C9+1082985]\n\tGetHandleVerifier [0x012F13A3+1081923]\n\tGetHandleVerifier [0x013ED9FD+2115741]\n\tOrdinal0 [0x0111B82E+1488942]\n\tOrdinal0 [0x010B5A7D+1071741]\n\tOrdinal0 [0x010B559B+1070491]\n\tOrdinal0 [0x010B54B1+1070257]\n\tOrdinal0 [0x010EFF53+1310547]\n\tBaseThreadInitThunk [0x770662C4+36]\n\tRtlSubscribeWnfStateChangeNotification [0x776B1B69+1081]\n\tRtlSubscribeWnfStateChangeNotification [0x776B1B34+1028]\n"}} Auto IT Script:
#Include "wd_core.au3" #Include "wd_helper.au3" Local $sDesiredCapabilities,$sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, 'index.html') _WD_LoadWait($sSession) Local $index = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "frameset:nth-of-type(1)") Local$index1 = _WD_FindElement($sSession,$_WD_LOCATOR_ByCSSSelector, "frameset:nth-of-type(1)", $index) Local$index2 = _WD_FindElement($sSession,$_WD_LOCATOR_ByCSSSelector, "frame:nth-of-type(1)", $index1) Local$index3 = _WD_FindElement($sSession,$_WD_LOCATOR_ByCSSSelector, "frameset:nth-of-type(1)", $index2) _WD_HighlightElement($sSession, $index2, 1) _WD_HighlightElement($sSession, $index3, 1) _WD_Shutdown() Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"')$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized","disable-infobars"]}}}}' EndFunc ;==>SetupChrome

frame1.html index.html
• By Sanja
Hello forum,
I have the problem that I can not use Firefox in combination with WebDriver when using AutoIt on some websites. Of course it does not work with the very website I need it to work with.
As soon as I want to open the desired website, I get the little robot icon which tells me that the "browser is under remote control" and the website stays blank.
I CAN open the website (www.ebay-kleinanzeigen.de) but I get blocked when I want to go to my account, to be precise.

I am using AutoIt 3.3.14.5 I have checked my FireFox version. It is up to date. Also the special browser drivers like gecko etrc. are up to date too and everything works fine with the WebDriver demo.
It seems that another user also had the same problem, but the thread has already been closed and the users solution (setting security lower did not work for me).
I mean I can only choose between "standard", "strict" and "customized". On "customized I unchecked everything but it still would not change anything.
I also have checked Google Chrome and MS Edge. Same result.
I tried swiching profiles (only with FireFox). Same result.
I tried to acess a previously opened FireFox session where I manually logged in by using this code snippet:
_WD_Option('Driver', 'C:\Path\to\the\executable\geckodriver.exe') _WD_Option('DriverParams', '--log trace --connect-existing  --marionette-port 2828') _WD_Option('Port', 4444) Obviously I adjusted the path of the geckodriver.exe but it did not work at all on my computer.
So far my code is really basically nothing but I can not even start to code. I myself am not a real coder and I know only the very basics like loops, conditions and variables.
----------------------------------------
; Script Start #include <Array.au3> #include <AutoItConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <File.au3> #include <GuiComboBoxEx.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <StaticConstants.au3> #include "wd_core.au3" #include "wd_helper.au3" #include <WindowsConstants.au3> Local $sDesiredCapabilities,$sSession, $sElement SetupGecko()$_WD_DEBUG = $_WD_DEBUG_None _WD_Startup()$sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://www.ebay-kleinanzeigen.de/m-meine-anzeigen.html?sort=CREATION_DATE_ASC&keyword=winter") Exit Func SetupGecko() _WD_Option('Driver', 'geckodriver.exe') _WD_Option('DriverParams', '--log trace --marionette-port 2828') _WD_Option('Port', 4444) $sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "' & "C:/Users/myaccount/AppData/Roaming/Mozilla/Firefox/Profiles/0123456.default-release" & '"],"log": {"level": "trace"}}}}}' EndFunc ;==>SetupGecko Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"')$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"]}}}}' EndFunc ;==>SetupChrome Func SetupEdge() _WD_Option('Driver', 'msedgedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\msedge.log"') \$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"binary": "' & StringReplace(@ProgramFilesDir, "\", "/") & '/Microsoft/Edge/Application/msedge.exe", "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false}}}}' EndFunc ;==>SetupEdge --------------------------------------
I left the three setup functions in, because I do not care what browser I use as long as I can start coding.
Also, please understand that I am not trying to be lazy here. I do not want someone to code for me. Maybe the problem is very basic, but I just do not know how to eliminate that restriction.
Is it something I need to uncheck in the browser settings or is it more complicated? If you need more information, I will be happy to provide those.
If somebody has an idea or a solution, I would very much appreciate it.

Edit:
I am not bothered by the robot icon itself. I do not care about it.  If I try to acess my regular ebay account: "https://mesg.ebay.de/mesgweb/ViewMessages/0" it works like a charm despite the notification that the browser is remotely controlled.
My problem is, that the first website does not load for some reason ONLY when the browser is remote controlled.
×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...