Is it possible to switch wifi networks?

While executing my test suite I have to switch between multiple wifi networks available.
In the middle of the execution I have to change my wifi connection from Wifi_Network_1 to Network_2 provided ssid name and password of wifi network. How can it be done?

In Which platform do u want to perform?

@Tany_S i need it for both android and ios platform

In iOS run the application in background and perform the operation u want(for example click on settings and switch wifi)
to run app in back ground
driver.runAppInBackground(Duration.ofSeconds(1));