美文网首页
[Airtest]7.[win]Firewall and Act

[Airtest]7.[win]Firewall and Act

作者: elf_fff | 来源:发表于2023-03-29 14:01 被阅读0次

    Firewall

    Firewall popup box sometimes prevents auto test running. I suggest to close it by command but not UI operation for a stable effect.

    // close firewall
    netsh advfirewall set allprofiles state off
    // open firewall
    netsh advfirewall set allprofiles state on
    

    Activate software

    One side effect of running command is the code can't detect the tested software, which will report pywinauto.findwindows.ElementNotFoundError.(Perhaps unfocused issue??)
    After I tried several times, if I click anywhere, connect_device() will work again. And before connect_device(), poco().click() can't be used. Now, we need to call pywinauto directly(which is also the basic module of airtest, no need installing).

    from pywinauto import mouse
    
    mouse.click(coords=(0, 0))  # click upper left corner
    connect_device("...")
    

    相关文章

      网友评论

          本文标题:[Airtest]7.[win]Firewall and Act

          本文链接:https://www.haomeiwen.com/subject/uoqxddtx.html