MWIProd Posted April 3 Share Posted April 3 Hi, With Internet Explorer, if I wanted to restore windows, I used : Local $hWnd = _IEPropertyGet($oIE, 'hwnd') WinSetState($hWnd, '', @SW_RESTORE) Is it possible to do same thing with _WD fonction ? Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted April 3 Share Posted April 3 (edited) Hi @MWIProdย , I don't know exactly what you're trying to achieve, but with the au3WebDriver project (WebDriver), the _WD_Window() function let you maximize, minimize etc. the browser window. Could you describe your use case, then I am sure we could help you more precisely. Best regards Sven Edited April 3 by SOLVE-SMART Danyfirex 1 Stay innovative! Spoiler ๐ย Au3Forums ๐ฒ AutoIt (en) Cheat Sheet ๐ AutoIt limits/defaults ๐ Code Katas: [...] (comming soon) ๐ญ Collection of GitHub users with AutoIt projects ๐ย False-Positives ๐ฎย Me on GitHub ๐ฌย Opinion about new forum sub category ๐ย UDF wiki list โย VSCode-AutoItSnippets ๐ย WebDriver FAQs ๐จโ๐ซย WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
Danp2 Posted April 3 Share Posted April 3 As indicated by Sven, you should be able to do this using _WD_Window. Take a look at the Rect option, which should allow you to restore the window. SOLVE-SMART 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
MWIProd Posted April 18 Author Share Posted April 18 Hi all, I didn't see 'restore' in optionsย Close|Frame|Fullscreen|Handles|Maximize|Minimize|New|Parent|Print|Rect|Screenshot|Switch|Window This is why I posted here. ย _WD_Window($_MY__WD_SESSION, 'rect', 'get') gives me : Quote _WD_Window ==> Invalid argument [5] : Parameters: ย Command=rect ย Option=get ย Link to comment Share on other sites More sharing options...
Nine Posted April 18 Share Posted April 18 I hardcoded the size and position, but you can extract it from the scripting dictionary object : #include "wd_core.au3" #include <File.au3> Local $sDesiredCapabilities = SetupChrome() _WD_Startup() Local $sSession= _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://google.com") ;Sleep(5000) $vRect = _WD_Window($sSession, "rect") ConsoleWrite(VarGetType($vRect) & @CRLF) For $vKeys in $vRect ConsoleWrite($vKeys & "/" & $vRect.item ($vKeys) & @CRLF) Next _WD_Window($sSession, "MINIMIZE") Sleep(1000) _WD_Window($sSession, "rect", '{"value":{"height":680,"width":948,"x":10,"y":10}}') ;_WD_DeleteSession($sSession) _WD_Shutdown() Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"') ;Return '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"]}}}}' Return '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "args":["--user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\", "--profile-directory=Default"]}}}}' EndFunc ย โThey did not know it was impossible, so they did itโย โ Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text ย Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker ย Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC ย HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet ย Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector ย Printer Manager GIF Animation (cached) Screen Scraping ย Multi-Threading Made Easy ย Link to comment Share on other sites More sharing options...
Danp2 Posted April 18 Share Posted April 18 4 hours ago, Nine said: _WD_Window($sSession, "rect", '{"value":{"height":680,"width":948,"x":10,"y":10}}') Try using null for all values, which should restore the window without moving or resizing it. SOLVE-SMART 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted April 18 Share Posted April 18 Only out of curiosityย @Nineย , why do you define these "args"? --user-data-dir --profile-directory Is there a specific need for it or is it just a "copy and paste" thingy? I am really asking because I don't know why this should be defined ๐ค . Thanks for any explanation ๐ค . ------------------------------- @Danp2ย could this be a improvement, to have something like ... _WD_Window($sSession, 'restore') in version v1.4.0 maybe? Besides that, I also see that the browser compatibility isn't very good ๐ . Best regards Sven Stay innovative! Spoiler ๐ย Au3Forums ๐ฒ AutoIt (en) Cheat Sheet ๐ AutoIt limits/defaults ๐ Code Katas: [...] (comming soon) ๐ญ Collection of GitHub users with AutoIt projects ๐ย False-Positives ๐ฎย Me on GitHub ๐ฌย Opinion about new forum sub category ๐ย UDF wiki list โย VSCode-AutoItSnippets ๐ย WebDriver FAQs ๐จโ๐ซย WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
Nine Posted April 18 Share Posted April 18 25 minutes ago, SOLVE-SMART said: why do you define these "args"? Because I prefer to use my own personal profile, not a generic/empty one. โThey did not know it was impossible, so they did itโย โ Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text ย Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker ย Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC ย HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet ย Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector ย Printer Manager GIF Animation (cached) Screen Scraping ย Multi-Threading Made Easy ย Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted April 18 Share Posted April 18 14 minutes ago, Nine said: Because I prefer to use my own personal profile, not a generic/empty one. Okay thanks. Then I have to read about these settings/options more in depth, because I still don't see the advantages of it. Best regards Sven Stay innovative! Spoiler ๐ย Au3Forums ๐ฒ AutoIt (en) Cheat Sheet ๐ AutoIt limits/defaults ๐ Code Katas: [...] (comming soon) ๐ญ Collection of GitHub users with AutoIt projects ๐ย False-Positives ๐ฎย Me on GitHub ๐ฌย Opinion about new forum sub category ๐ย UDF wiki list โย VSCode-AutoItSnippets ๐ย WebDriver FAQs ๐จโ๐ซย WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
Nine Posted April 18 Share Posted April 18 (edited) 1 hour ago, Danp2 said: Try using null for all values Not working for me, what would be the syntax that you have in mind, I tried a few and no success... NVM -- got it working, had a syntax error Edited April 18 by Nine โThey did not know it was impossible, so they did itโย โ Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text ย Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker ย Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC ย HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet ย Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector ย Printer Manager GIF Animation (cached) Screen Scraping ย Multi-Threading Made Easy ย Link to comment Share on other sites More sharing options...
Nine Posted April 18 Share Posted April 18 4 minutes ago, SOLVE-SMART said: I still don't see the advantages of it In some web sites, it will continually ask you to accept cookies for example.ย But when you use your own profile, they will ask you only once. Same goes for un/pw, etc. SOLVE-SMART 1 โThey did not know it was impossible, so they did itโย โ Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text ย Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker ย Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC ย HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet ย Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector ย Printer Manager GIF Animation (cached) Screen Scraping ย Multi-Threading Made Easy ย Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted April 18 Share Posted April 18 Okay, that's a good one, thanks @Nineย ๐ . Best regards Sven Stay innovative! Spoiler ๐ย Au3Forums ๐ฒ AutoIt (en) Cheat Sheet ๐ AutoIt limits/defaults ๐ Code Katas: [...] (comming soon) ๐ญ Collection of GitHub users with AutoIt projects ๐ย False-Positives ๐ฎย Me on GitHub ๐ฌย Opinion about new forum sub category ๐ย UDF wiki list โย VSCode-AutoItSnippets ๐ย WebDriver FAQs ๐จโ๐ซย WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted April 18 Share Posted April 18 7 minutes ago, Nine said: NVM -- got it working, had a syntax error Can you please share how you did it? I cannot test it right now, but I believe to know how I would do it ๐ . Thanks again in advance. Best regards Sven Stay innovative! Spoiler ๐ย Au3Forums ๐ฒ AutoIt (en) Cheat Sheet ๐ AutoIt limits/defaults ๐ Code Katas: [...] (comming soon) ๐ญ Collection of GitHub users with AutoIt projects ๐ย False-Positives ๐ฎย Me on GitHub ๐ฌย Opinion about new forum sub category ๐ย UDF wiki list โย VSCode-AutoItSnippets ๐ย WebDriver FAQs ๐จโ๐ซย WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
Nine Posted April 18 Share Posted April 18 Here : _WD_Window($sSession, "rect", '{"value":{"height":0,"width":0,"x":0,"y":0}}') restores as it should be.ย Not obvious to know it.ย Should be in help file, or like you propose to have a specificย "restore"ย command. SOLVE-SMART 1 โThey did not know it was impossible, so they did itโย โ Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text ย Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker ย Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC ย HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet ย Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector ย Printer Manager GIF Animation (cached) Screen Scraping ย Multi-Threading Made Easy ย Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted April 18 Share Posted April 18 Thanks again. I was looking directly in the WebDriver documentation, not in au3WebDriver project. I am a bit suprised now, because I would have used null instead of the zeros. Interesting ... . I will also test it tomorrow and will have a look into the docs again. Maybe I will create an GitHub issue (or even PR) for @Danp2. Then we will see ๐ค๐ . Best regards Sven Stay innovative! Spoiler ๐ย Au3Forums ๐ฒ AutoIt (en) Cheat Sheet ๐ AutoIt limits/defaults ๐ Code Katas: [...] (comming soon) ๐ญ Collection of GitHub users with AutoIt projects ๐ย False-Positives ๐ฎย Me on GitHub ๐ฌย Opinion about new forum sub category ๐ย UDF wiki list โย VSCode-AutoItSnippets ๐ย WebDriver FAQs ๐จโ๐ซย WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted April 18 Share Posted April 18 Last words on this, for my side today: There is a "normal" keyword which is also new to me. Maybe even better then the restore thingy. I don't know yet, but I will investigate a bit. https://w3c.github.io/webdriver/#resizing-and-positioning-windows Best regards Sven Stay innovative! Spoiler ๐ย Au3Forums ๐ฒ AutoIt (en) Cheat Sheet ๐ AutoIt limits/defaults ๐ Code Katas: [...] (comming soon) ๐ญ Collection of GitHub users with AutoIt projects ๐ย False-Positives ๐ฎย Me on GitHub ๐ฌย Opinion about new forum sub category ๐ย UDF wiki list โย VSCode-AutoItSnippets ๐ย WebDriver FAQs ๐จโ๐ซย WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted April 19 Share Posted April 19 I could verify your restore parameters (and syntax etc.) @Nineย and could test it successfully on Chrome, Firefox and MSEdge. I also created (a few minutes ago) an GitHub Issue and PR for this topic that can be reviewed by @Danp2ย when he have the time for it. I believe _WD_Window($sSession, 'restore') should be more intuitive or for some even more familiar like in other frameworks like Selenium or WebdriverIO. Let's see what will happen ๐ . ----------------- @MWIProd I guess this thread can be closed, right? Best regards Sven Stay innovative! Spoiler ๐ย Au3Forums ๐ฒ AutoIt (en) Cheat Sheet ๐ AutoIt limits/defaults ๐ Code Katas: [...] (comming soon) ๐ญ Collection of GitHub users with AutoIt projects ๐ย False-Positives ๐ฎย Me on GitHub ๐ฌย Opinion about new forum sub category ๐ย UDF wiki list โย VSCode-AutoItSnippets ๐ย WebDriver FAQs ๐จโ๐ซย WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now