Search code examples
seleniumrobotframeworkwebautomation

Robot Framework Keyword for Connecting and disconnecting internet


Has anyone here used a robot framework for web automation to execute a test case involving connect and disconnect to the internet?

I have used appium for mobile, but not sure how to do this on the web. I am using selenium Library and it's a web automation.


Solution

  • Not sure with robot framework but you can try with python instead.

    import subprocess

    to disconnect

    result = subprocess.run(["netsh", "interface", "set", "interface", "Wi-Fi", "DISABLED"])

    print(result.returncode)

    to connect

    result = subprocess.run(["netsh", "interface", "set", "interface", "Wi-Fi", "ENABLED"])

    print(result.returncode)