ChromeSwitchWindow


 

ChromeSwitchWindow>session_id,window_handle,result

 

Switches the browsing context of a session created by ChromeStart to the specified window/tab. Requires a window handle retrieved with ChromeGetWindows.


 

See also: Chrome Functions

 

Example

 

Let>CHROMEDRIVER_EXE=c:\chromedriver.exe


 

//start a chrome session

ChromeStart>session_id


 

//navigate to google.com

ChromeNavigate>session_id,url,https://www.w3schools.com/jsref/met_win_open.asp


 

//Click on accept

ChromeFindElements>session_id,id,accept-choices,elements

ChromeElementAction>session_id,elements_1,click


 

Wait>1

//clicking on Try it yourself will create a new tab

ChromeFindElements>session_id,link text,Try it Yourself �,elements

ChromeElementAction>session_id,elements_1,click


 

Wait>1


 

//find the new tab handle (it's window 2) and switch to it

ChromeGetWindows>session_id,window_list

ChromeSwitchWindow>session_id,window_list_2,result


 

//now click on the menu button on the new tab

ChromeFindElements>session_id,id,menuButton,allAs

ChromeElementAction>session_id,allAs_1,click