[Airtest]7.[win]Firewall and Act

2023-03-29  本文已影响0人  elf_fff

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("...")
上一篇 下一篇

猜你喜欢

热点阅读