HezzelQuartz Posted March 4 Posted March 4 How to know the handle of first create tab in webdriver? If my code is below: ย #include "wd_core.au3" #include "wd_helper.au3" Local $sDesiredCapabilities, $sSession SetupGecko() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) ;========================================================================= $sTab1 = _WD_NewTab($sSession) _WD_Navigate($sSession, "https://www.xzy.xzy/") $sTab2 = _WD_NewTab($sSession) _WD_Navigate($sSession, "https://www.abc.abc/") _WD_Window($sSession, 'Switch', '{"handle":"' & $sTab1 & '"}') ;========================================================================= Func SetupGecko() _WD_Option('Driver', 'geckodriver.exe') _WD_Option('Port', 4444) _WD_Option('DriverParams', '--log trace') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"browserName": "firefox", "acceptInsecureCerts":true}}}' EndFunc There will be 3 tab first tab is empty second tab is xyz third tab is abc it will first open firefox and create first tab which is empty then it will create second tab and navigate to xyz then it will create third tab and navigate to abc then it will attach back to second tab which is xyz my question is: i know the handle of the second and third tab from the handle returned when doing _WD_NewTab but how can I switch back to the first empty tab? Thank You ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @SOLVE-SMART Sorry for creating new topic again
SOLVE-SMART Posted March 5 Posted March 5 (edited) 6 hours ago, HezzelQuartz said: Sorry for creating new topic again No, it's good to separate topics in new threads ๐ . ----------- An example on handling multiple tabs can be found here (autoit-webdriver-boilerplate). Read section: README > Features > Branches > "multiple-browser-tabs" Have a deeper look at functionย _Steps()ย and the functions _NextTab(), _PreviousTab() and _CloseTab. I believe this should be helpful ๐ค . Best regards Sven Edited March 5 by SOLVE-SMART ==> AutoIt related: ๐ GitHub, ๐ Discord Server 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)
HezzelQuartz Posted March 5 Author Posted March 5 (edited) 1 hour ago, SOLVE-SMART said: No, it's good to separate topics in new threads ๐ . ----------- An example on handling multiple tabs can be found here. 1. Read section: README > Features > Branches > "multiple-browser-tabs" 2. Have a deeper look at functionย _Steps()ย and the functions _NextTab(), _PreviousTab() and _CloseTab. I believe this should be helpful ๐ค . Best regards Sven @SOLVE-SMART Sorry, is that newer webdriver udf? Should I change udf? I actually confused could you give me simple example or clue how to use that udf? Thank You Edited March 5 by HezzelQuartz
Solution SOLVE-SMART Posted March 5 Solution Posted March 5 (edited) No it is not a different one. It's a wrapper around the great work / UDF of @Danp2ย (and @mLipok). As described in the description (README): Quote The project "autoit-webdriver-boilerplate" can be used as quick entry point for the awesome au3WebDriver project by @Danp2 (and @mlipok). The intention is, give people a easy start with WebDriver for AutoIt. I simply wanted to show you an example on how to deal with multiple tabs, because this topic was asked before and I added such a example (as separate git branch) on my repository/project. So you can either read through the project and give it a try or you stick to the examples of the wd_demo.au3 of the origin au3WebDriver project. All is fine. In the mentioned functions _NextTab(), _PreviousTab() and _CloseTab you can see one approach to handle browser tabs. In the _Steps() function you see the usage of these functions. I do have video tutorials online for the autoit-webdriver-boilerplate (a crash course), but in german. So I guess it's not that helpful. -------------------- My suggestion: Concentrate on your current task (handling browser tabs, as you asked in this thread). Then, if you want, walk through my boilerplate project and give it a try. If it's not documented good enough, please let me know. I am grateful for improvement ideas ๐ค . Best regards Sven Edited March 5 by SOLVE-SMART ==> AutoIt related: ๐ GitHub, ๐ Discord Server 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)
HezzelQuartz Posted March 5 Author Posted March 5 1 hour ago, SOLVE-SMART said: No it is not a different one. It's a wrapper around the great work / UDF of @Danp2ย (and @mLipok). As described in the description (README): I simply wanted to show you an example on how to deal with multiple tabs, because this topic was asked before and I added such a example (as separate git branch) on my repository/project. So you can either read through the project and give it a try or you stick to the examples of the wd_demo.au3 of the origin au3WebDriver project. All is fine. In the mentioned functions _NextTab(), _PreviousTab() and _CloseTab you can see one approach to handle browser tabs. In the _Steps() function you see the usage of these functions. I do have video tutorials online for the autoit-webdriver-boilerplate (a crash course), but in german. So I guess it's not that helpful. -------------------- My suggestion: Concentrate on your current task (handling browser tabs, as you asked in this thread). Then, if you want, walk through my boilerplate project and give it a try. If it's not documented good enough, please let me know. I am grateful for improvement ideas ๐ค . Best regards Sven Now, I Understand Thank You Really Helpful for me
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