I want to check that:
-
if the state is true and the connection type is not 2 or 6 then do something.
-
if state is false and connection type is either 2 or 6 then do something else.
I have the following if statements but at points it is using the wrong code:
async setWiFiConnection(state){
try{
var connType = await driver.getNetworkConnection();
if(state == true && connType != 2 && connType != 6){
await driver.toggleWiFi();
}else if(state == false && connType == 2 || connType == 6){
await driver.toggleWiFi();
}
}catch(err){
console.log(err);
}
}
I think the issue is if the connection type is 6 even if state is true then the else if code is being executed.
Aucun commentaire:
Enregistrer un commentaire