Danp2 / au3WebDriver

Web Driver UDF for AutoIt
MIT License
107 stars 23 forks source link

added _WD_DebugSwitch() #340

Closed mlipok closed 2 years ago

mlipok commented 2 years ago

Pull request

Proposed changes

This PR adds function _WD_DebugSwitch() which give a way to switch and switch back between $_WD_DEBUG levels.

Checklist

Put an x in the boxes that apply. If you're unsure about any of them, don't hesitate to ask. We are here to help!
This is simply a reminder of what we are going to look for before merging your code.

Types of changes

Please check x the type of change your PR introduces:

What is the current behavior?

When you want to switch to $_WD_DEBUG_Full and then back then you must rember what level was set previously.

What is the new behavior?

this following example shows new behavior:

_MAIN()

Func _Main()
    ; presetting
    $_WD_DEBUG = $_WD_DEBUG_None

    _1()

    ; restore settings ($_WD_DEBUG_None)
    _WD_DebugSwitch()

    ; set new debug level
    $_WD_DEBUG = $_WD_DEBUG_Error
    ; reset switch internall storage to new setting ($_WD_DEBUG_Error)
    _WD_DebugSwitch(Null)

EndFunc

Func _1()
    ; first usage - internally store current settings + switch to $_WD_DEBUG_Full
    _WD_DebugSwitch($_WD_DEBUG_Full)
    ; do your stuff
    _2()
    ; do your stuff
EndFunc

Func _2()
    ; switch to $_WD_DEBUG_Error
    _WD_DebugSwitch($_WD_DEBUG_Error)
    ; do your stuff
EndFunc

Additional context

https://www.autoitscript.com/forum/topic/205553-webdriver-udf-help-support-iii/?do=findComment&comment=1504312

System under test

not related

Danp2 commented 2 years ago

Not sure why you submitted this when we were discussing it elsewhere, but marked the PR as draft because this isn't ready to be merged.

mlipok commented 2 years ago

I must to rethink this function.