Jump to content

Recommended Posts

Posted
  On 9/3/2021 at 5:00 PM, Danp2 said:

You sure are a fan of underscores. 😜

Expand  

 

  On 6/28/2014 at 3:33 AM, jaberwacky said:

mLipok, the master of finding bugs.

Expand  

hahahah.....

 

 

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 Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 9/3/2021 at 5:02 PM, Danp2 said:

This should be a comma instead of a colon. Otherwise, I think the formatting is good.

Expand  

searching.....

btw:
https://stackoverflow.com/questions/69048644/webdriver-chrome-list-of-excludeswitches

 

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 Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

as for now I'm on this stage:

Func _Example_Danp2()
    Local $s_My_Profile_Dir = @ScriptDir & '\WD_Testing_Profile'
    
;~  __WD_Capabilities__Startup()
;~  __WD_Capabilities__Capability('browserName', 'firefox')
;~  __WD_Capabilities__Capability('acceptInsecureCerts', True)
;~  __WD_Capabilities__Argument('-profile')
;~  __WD_Capabilities__Argument($s_My_Profile_Dir)
;~  Local $s_Desired_Capabilities = __WD_Capabilities__Build('firefox')

    _WD_Capabilities($_WD_CAPS__STARTUP)
    _WD_Capabilities($_WD_CAPS__ADD_CAPABILITY, 'browserName', 'firefox')
    _WD_Capabilities($_WD_CAPS__ADD_CAPABILITY, 'acceptInsecureCerts', True)
    _WD_Capabilities($_WD_CAPS__ADD_ARGUMENT, '-profile')
    _WD_Capabilities($_WD_CAPS__ADD_ARGUMENT, $s_My_Profile_Dir)
    Local $s_Desired_Capabilities = _WD_Capabilities($_WD_CAPS__BUILD, 'firefox')

    ConsoleWrite($s_Desired_Capabilities & @CRLF)
    ConsoleWrite('=============' & @CRLF)
EndFunc   ;==>_Example_Danp2

 

How it looks ?

Maybe enums should also be trimmed....

Global Enum
        $_WD_CAPS_STARTUP = 11001, _
        $_WD_CAPS_CAPABILITY, _
        $_WD_CAPS_EXCLUSION, _
        $_WD_CAPS_OPTION, _
        $_WD_CAPS_ARGUMENT, _
        $_WD_CAPS_PREFERENCE, _
        $_WD_CAPS_LOG, _
        $_WD_CAPS_ENV, _
        $_WD_CAPS_BUILD, _
        $_WD_CAPS_COUNTER

 

or....
 

Global Enum
        $_WD_CAPS_Startup = 11001, _
        $_WD_CAPS_Capability, _
        $_WD_CAPS_Exclusion, _
        $_WD_CAPS_Option, _
        $_WD_CAPS_Argument, _
        $_WD_CAPS_Preference, _
        $_WD_CAPS_Log, _
        $_WD_CAPS_Env, _
        $_WD_CAPS_Build, _
        $_WD_CAPS_COUNTER

 

Edited 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 Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Personally I prefer separate function for each action

Reason 1: smaller code

Func _Example_1()
    Local $s_My_Profile_Dir = @ScriptDir & '\WD_Testing_Profile'
    
    _WD_Capabilities_Startup()
    _WD_Capabilities_Capability('browserName', 'firefox')
    _WD_Capabilities_Capability('acceptInsecureCerts', True)
    _WD_Capabilities_Argument('-profile')
    _WD_Capabilities_Argument($s_My_Profile_Dir)
    Local $s_Desired_Capabilities = _WD_Capabilities_Build('firefox')
EndFunc   ;==>_Example_Danp2

Func _Example_2()
    Local $s_My_Profile_Dir = @ScriptDir & '\WD_Testing_Profile'
    
    _WD_Capabilities($_WD_CAPS__STARTUP)
    _WD_Capabilities($_WD_CAPS__ADD_CAPABILITY, 'browserName', 'firefox')
    _WD_Capabilities($_WD_CAPS__ADD_CAPABILITY, 'acceptInsecureCerts', True)
    _WD_Capabilities($_WD_CAPS__ADD_ARGUMENT, '-profile')
    _WD_Capabilities($_WD_CAPS__ADD_ARGUMENT, $s_My_Profile_Dir)
    Local $s_Desired_Capabilities = _WD_Capabilities($_WD_CAPS__BUILD, 'firefox')

EndFunc   ;==>_Example_Danp2


Reason 2: function list

image.png.8332f4cf04b1521f29c91bf72240406a.png

Reason 3: Caltips

image.png.c119b04f152b5a4eb56e7a6a3eecfcc8.png

using $_WD_CAPS_* there is lack of direct information what to put into parameters

image.png.510929d73835c7e1b348ca7693955dd5.png

 

Reason 4: easier to understand UDF Function Header (aka documentation) 
of course when it will be crated ;)

 

btw.
Of course, both forms can coexist simultaneously.

Edited 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 Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  Quote

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

Expand  

Just for fun:

  Reveal hidden contents

 

Saludos

Posted
  On 9/4/2021 at 1:51 AM, Danyfirex said:

Just for fun:

Expand  

This is that kind of AutoIt magic which I was talking about.

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 Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 9/3/2021 at 6:19 PM, mLipok said:

Personally I prefer separate function for each action

Expand  

I see that @Danyfirex gave me a react_thanks.png so ask only @Danp2:  What you think about this concept ?

 

  On 9/3/2021 at 6:19 PM, mLipok said:

btw.
Of course, both forms can coexist simultaneously.

Expand  

@Danp2 and @Danyfirex : What do you both think of this concept?

 

 

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 Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 9/5/2021 at 9:45 AM, mLipok said:

 

  On 9/3/2021 at 6:19 PM, mLipok said:

btw.
Of course, both forms can coexist simultaneously.

Expand  

@Danp2 and @Danyfirex : What do you both think of this concept?

Expand  

btw.
I just use kind a wrapper for this so this is already workable

Global Enum _
        $_WD_CAPS__STARTUP = 11001, _
        $_WD_CAPS__ADD_CAPABILITY, _
        $_WD_CAPS__ADD_EXCLUSION, _
        $_WD_CAPS__ADD_OPTION, _
        $_WD_CAPS__ADD_ARGUMENT, _
        $_WD_CAPS__ADD_PREFERENCE, _
        $_WD_CAPS__ADD_LOG, _
        $_WD_CAPS__ADD_ENV, _
        $_WD_CAPS__BUILD, _
        $_WD_CAPS__COUNTER

Func _WD_Capabilities($_CAP_ACTION, $PARAM1 = '', $PARAM2 = '')
    Switch $_CAP_ACTION
        Case $_WD_CAPS__STARTUP
            __WD_Capabilities__Startup()
        Case $_WD_CAPS__ADD_CAPABILITY
            __WD_Capabilities__Capability($PARAM1, $PARAM2)
        Case $_WD_CAPS__ADD_EXCLUSION
            __WD_Capabilities__ExcludeSwitches($PARAM1)
        Case $_WD_CAPS__ADD_OPTION
            __WD_Capabilities__Option($PARAM1, $PARAM2)
        Case $_WD_CAPS__ADD_ARGUMENT
            __WD_Capabilities__Argument($PARAM1, $PARAM2)
        Case $_WD_CAPS__ADD_PREFERENCE
            __WD_Capabilities__Preference($PARAM1, $PARAM2)
        Case $_WD_CAPS__ADD_LOG
            __WD_Capabilities__Log($PARAM1, $PARAM2)
        Case $_WD_CAPS__ADD_ENV
            __WD_Capabilities__Env($PARAM1, $PARAM2)
        Case $_WD_CAPS__BUILD
            Return __WD_Capabilities__Build($PARAM1)
    EndSwitch
EndFunc   ;==>_WD_Capabilities

 

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 Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
Posted
  On 9/2/2021 at 1:30 PM, Danp2 said:

Yes, I would recommend support for both options since that's in line with the W3C specs.

Expand  

Do "firstMatch" support only standard capabilities ?
.... or also vendor specific capabilities ?
 

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 Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

I use this example:

https://developer.mozilla.org/en-US/docs/Web/WebDriver/Timeouts#setting_and_getting_timeouts_at_runtime

{"implicit": 4.5, "script": 300, "pageLoad": 30000}

and I add support for capability "timeouts" which have value as JSON object

__WD_Capabilities__Capability('timeouts', '{"implicit": 4, "script": 300, "pageLoad": 30000}')

 

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 Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 9/5/2021 at 5:54 PM, mLipok said:

Do "firstMatch" support only standard capabilities ?
.... or also vendor specific capabilities ?

Expand  

Both AFAIK.

  On 9/5/2021 at 6:51 PM, mLipok said:

I add support for capability "timeouts"

Expand  

I don't believe that I've ever needed to use timeouts in the Capacities string. I've always used _WD_Timeouts to get / set these values at runtime.

Posted (edited)
  On 9/5/2021 at 7:13 PM, Danp2 said:

I don't believe that I've ever needed to use timeouts in the Capacities string. I've always used _WD_Timeouts to get / set these values at runtime.

Expand  

But possibility to set this particular capabilitiy in this UDF is desirable ?

Edited 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 Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 9/5/2021 at 7:13 PM, Danp2 said:
  On 9/5/2021 at 5:54 PM, mLipok said:

Do "firstMatch" support only standard capabilities ?
.... or also vendor specific capabilities ?

Expand  

Both AFAIK.

Expand  


Does it mean that both "alwaysMatch" and "firstMatch" should have the same configuration possibilities, i.e. allow all "JSON Array" and all "JSON Objects" to be set in the same way ?

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 Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • mLipok changed the title to wd_capabilities.au3 - support topic - BETA - Work In Progress
Posted (edited)
  On 9/5/2021 at 7:23 PM, mLipok said:


Does it mean that both "alwaysMatch" and "firstMatch" should have the same configuration possibilities, i.e. allow all "JSON Array" and all "JSON Objects" to be set in the same way ?

Expand  

Take a look here:

https://developer.mozilla.org/en-US/docs/Web/WebDriver/Capabilities#combining_alwaysmatch_and_firstmatch

{
  "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"}
    ]
  }
}


"alwaysMatch": {JSON OBJECT}
"firstMatch"" [JSON ARRAY of {JSON OBJECT}]

Do I understand it correctly?

EDIT:
I mean that this {JSON OBJECT} should have the same settings, features.
But the "firstMatch" can have them duplicated for lets say "for many different scenarios"

for example:

image.png.eb97d67f9349659d5b5cd323af0a9703.png

Objects from line 5, 36, 66, 96, 126 .... they should be able to set the same content ?
Am I right ?

Edited 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 Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Take a look on this concept:

Func _Example()
    ....
    ....
    ....
    #Region - create "alwayMatch" JSON Object   
    _WD_Capabilities_Startup()
    _WD_Capabilities_Capability(.....
    _WD_Capabilities_ExcludeSwitches(.....
    _WD_Capabilities_Option(.....
    _WD_Capabilities_Argument(.....
    _WD_Capabilities_Preference(.....
    _WD_Capabilities_Log(.....
    _WD_Capabilities_Env(.....
    _WD_Capabilities_Build("firefox", "alwaysMatch")
    #EndRegion
        
    
    #Region - create first JSON Object  in "firstMatch" JSON ARRAY
    _WD_Capabilities_Startup()
    _WD_Capabilities_Capability(.....
    _WD_Capabilities_ExcludeSwitches(.....
    _WD_Capabilities_Option(.....
    _WD_Capabilities_Argument(.....
    _WD_Capabilities_Preference(.....
    _WD_Capabilities_Log(.....
    _WD_Capabilities_Env(.....
    _WD_Capabilities_Build("firefox", "firstMatch")
    #Region - create alwayMatch JSON Object 
    
    #Region - create second JSON Object in "firstMatch" JSON ARRAY
    _WD_Capabilities_Startup()
    _WD_Capabilities_Capability(.....
    _WD_Capabilities_ExcludeSwitches(.....
    _WD_Capabilities_Option(.....
    _WD_Capabilities_Argument(.....
    _WD_Capabilities_Preference(.....
    _WD_Capabilities_Log(.....
    _WD_Capabilities_Env(.....
    _WD_Capabilities_Build("firefox", "firstMatch")
    #Region - create alwayMatch JSON Object 


    ; create entire Capability JSON
    Local $s_Desired_Capabilities = _WD_Capabilities_Build()

    ....
    ....
    ....
EndFunc

What you think about ?

It would be quite easy to achive, I only need to know if my understanding of "alwaysMatch" and "firstMatch" is correct ?

Edited 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 Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Guest
This topic is now closed to further replies.
×
×
  • Create New...