-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend _WD_Window() function by _WD_Window($sSession, 'restore') #514
Comments
I tested the change on the current Chrome, Firefox and MSEdge drivers. |
Did you happen to test this using |
@Sven-Seyfert could you please provide modified UserTesting() function to use it with wd_demo.au3 #Region - UserTesting
Func UserTesting()
.....
EndFunc ;==>UserTesting
; if necessary, add any additional function required for testing within this region here
#EndRegion - UserTesting |
You are right @Danp2 , the But I also encountered that my syntax for the "rect" POST (basically taken from Nine on the forum thread) was not the exact one. I mean, the restore POST request is basically the same as the resize variant => both by I will show it in the UserTesting section like @mlipok already suggested 🤝 . Best regards Update: |
Do you mean I should provide a temporary example in this I will show the example here as Best regards |
@mlipok I hope you meant this: #Region - UserTesting
Func UserTesting()
; if necessary, you can modify the following function content by replacing, adding any additional function required for testing within this function
Local $vResult
$vResult = _WD_Navigate($sSession, 'https://www.google.com')
If @error Then Return SetError(@error, @extended, $vResult)
$vResult = _WD_LoadWait($sSession, 10, Default, Default, $_WD_READYSTATE_Interactive)
If @error Then Return SetError(@error, @extended, $vResult)
MsgBox(64, '_WD_Window', StringFormat( _
'1. Window will be set to 1440x810\n' & _
'2. Window will be restored to default\n' & _
'3. Window will be maximized\n' & _
'4. Window will be restored\n' & _
'5. Window will be set to 1920x1080\n' & _
'6. Window will be set to fullscreen\n' & _
'7. Window will be restored again\n' & _
'8. Window will be set to 1440x810'))
Local Const $sResizeParametersA = '{"x": null, "y": null, "width": 1440, "height": 810}'
Local Const $sResizeParametersB = '{"x": null, "y": null, "width": 1920, "height": 1080}'
ConsoleWrite('1. Window will be set to 1440x810' & @CRLF)
_WD_Window($sSession, 'rect', $sResizeParametersA)
Sleep(500)
ConsoleWrite('2. Window will be restored to default' & @CRLF)
_WD_Window($sSession, 'restore')
Sleep(500)
ConsoleWrite('3. Window will be maximized' & @CRLF)
_WD_Window($sSession, 'maximize')
Sleep(500)
ConsoleWrite('4. Window will be restored' & @CRLF)
_WD_Window($sSession, 'restore')
Sleep(500)
ConsoleWrite('5. Window will be set to 1920x1080' & @CRLF)
_WD_Window($sSession, 'rect', $sResizeParametersB)
Sleep(500)
ConsoleWrite('6. Window will be set to fullscreen' & @CRLF)
_WD_Window($sSession, 'fullscreen')
Sleep(500)
ConsoleWrite('7. Window will be restored again' & @CRLF)
_WD_Window($sSession, 'restore')
Sleep(500)
ConsoleWrite('8. Window will be set to 1440x810' & @CRLF)
_WD_Window($sSession, 'rect', $sResizeParametersA)
Sleep(500)
EndFunc ;==>UserTesting
; if necessary, add any additional function required for testing within this region here
#EndRegion - UserTesting It works fine with Chrome, Firefox and MSEdge (current versions, on my system) ✅ . |
Will check ASAP |
some small changes: Func UserTesting()
; if necessary, you can modify the following function content by replacing, adding any additional function required for testing within this function
Local $vResult
$vResult = _WD_Navigate($sSession, 'https://www.google.com')
If @error Then Return SetError(@error, @extended, $vResult)
$vResult = _WD_LoadWait($sSession, 10, Default, Default, $_WD_READYSTATE_Interactive)
If @error Then Return SetError(@error, @extended, $vResult)
MsgBox(64, '_WD_Window', StringFormat( _
'1. Window will be set to 1440x810\n' & _
'2. Window will be restored to default\n' & _
'3. Window will be maximized\n' & _
'4. Window will be restored\n' & _
'5. Window will be set to 1920x1080\n' & _
'6. Window will be set to fullscreen\n' & _
'7. Window will be restored again\n' & _
'8. Window will be set to 1440x810'))
Local Const $sResizeParametersA = '{"x": null, "y": null, "width": 1440, "height": 810}'
Local Const $sResizeParametersB = '{"x": null, "y": null, "width": 1920, "height": 1080}'
ConsoleWrite('1. Window will be set to 1440x810' & @CRLF)
_WD_Window($sSession, 'rect', $sResizeParametersA)
MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 'after set to 1440x810')
ConsoleWrite('2. Window will be restored to default' & @CRLF)
_WD_Window($sSession, 'restore')
MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 'after restored to default')
ConsoleWrite('3. Window will be maximized' & @CRLF)
_WD_Window($sSession, 'maximize')
MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 'after maximized')
ConsoleWrite('4. Window will be restored' & @CRLF)
_WD_Window($sSession, 'restore')
MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 'after restored')
ConsoleWrite('5. Window will be set to 1920x1080' & @CRLF)
_WD_Window($sSession, 'rect', $sResizeParametersB)
MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 'after set to 1920x1080')
ConsoleWrite('6. Window will be set to fullscreen' & @CRLF)
_WD_Window($sSession, 'fullscreen')
MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 'after set to fullscreen')
ConsoleWrite('7. Window will be restored again' & @CRLF)
_WD_Window($sSession, 'restore')
MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 'after restored again')
ConsoleWrite('8. Window will be set to 1440x810' & @CRLF)
_WD_Window($sSession, 'rect', $sResizeParametersA)
MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 'after set to 1440x810')
EndFunc ;==>UserTesting |
I tested it with all browsers only opera act differently some kind of weired but it is not related to your proposal. All browsers have do the same actions but none of them takes any visual actions on any of |
What do mean by "visual actions" here @mlipok 🤔 ? Do you mean nothing will be restored? Of course you have to take my changes in the PR #515 to test it. But I am pretty sure you did this. So what should be a visual change? With the restore action, the windows size changes - correctly in my test cases. Best regards |
eee.... must to review again.... not updated to your version. |
after browser is initialized let say this was STEP 0 in STEP 1 window is moved ConsoleWrite('1. Window will be set to 1440x810' & @CRLF)
_WD_Window($sSession, 'rect', $sResizeParametersA)
MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 'after set to 1440x810') In STEP 2 No visual change - I was expecting that the window will back to size and position which was just after STEP 0 and before STEP 1 ConsoleWrite('2. Window will be restored to default' & @CRLF)
_WD_Window($sSession, 'restore')
MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 'after restored to default') all further STEPS works well. |
No worries @mlipok . I am happy that you take the time to review and test it, thank you 😊 . You don't have to hurry up. |
Aa you can see above I was able to test it again ;) |
You're right. I think this is intended behavior. Only actions like "minimized", "maximized" and "fullscreen" can be restored. See resizing-and-positioning-windows.
That is also correct. Unfortunately because of the browser_compatibility, I guess. 👉 That's the behavior of the "rect" endpoint |
Feature request
Is your feature request related to a problem? Please describe
On this forum thread were the question about How to restore the driver window?. After some tryouts and research it became clear that it was already possible with
_WD_Window($sSession, 'rect' ...)
, but this was not so easy to understand and not intuitive.Describe the solution you'd like
So I suggest to extend the function by a
'restore'
command which should be more intuitive or for some even more familiar like in other frameworks like Selenium or WebdriverIO. Code changes are visible in PR #515 👀 .Describe alternatives you've considered
Alternatives? Leave it as it is and the next question about the usage of 'rect' will come I predict 😅 .
Additional context
Use Case:
You start with a sized driver window (by the "args" capability), e. g. 1440x810, and you will use
_WD_Window($sSession, 'maximize')
to maximize the driver window, then later on you want to get back to the previous size, you only have to use_WD_Window($sSession, 'restore')
. Done.Influences and relationship to other functionality
Only
_WD_Window
related.The text was updated successfully, but these errors were encountered: