How to Check Internet Connection on Android Real Device
I tried several options:
-
- AndroidDriver.ExecuteScript(“mobile: shell”, "ping -c1 www.google.com").ToString();
-
- AndroidDriver.ExecuteScript(“mobile: shell”, “{‘command’: ‘ping’, ‘args’: [’-c1’, ‘www.google.com’]}”).ToString();
-
- AndroidDriver.ExecuteScript(“mobile: shell”, new object[] { “ping”, “www.google.com” }).ToString();
Everyone gets an error message:
error: command’ argument is mandatory