0
我試圖在切換應用程序時使用UI自動化來測試書寫和從UIPasteboard
讀取。但是,腳本在切換到第二個應用程序後掛起。我試着讓測試進入睡眠狀態,以防止它掛起。我嘗試過使用waitForInvalid
和pushTimeout/popTimeout
,這兩種方法似乎都不起作用,並且在第二個應用中登錄logElementTree
之前,測試仍然掛起。iOS UIAutomation:切換應用程序
這是我的UI自動化腳本,使用waitForInvalid
。 (該「紙板共享」按鈕,是它推出的第二個應用程序):是一個使用腳本pushTimeout/popTimeout
var target = UIATarget.localTarget();
target.frontMostApp().mainWindow().segmentedControls()[0].buttons()["1MB"].tap();
target.frontMostApp().mainWindow().buttons()["Pasteboard Sharing"].tap();
UIATarget.localTarget().frontMostApp().mainWindow().buttons()["Paste & Go"]
.tap();
UIATarget.localTarget().frontMostApp().mainWindow().buttons()["Paste & Go"]
.waitForInvalid();
target.frontMostApp().mainWindow().logElementTree();
在這裏:
var target = UIATarget.localTarget();
target.frontMostApp().mainWindow().segmentedControls()[0].buttons()["1MB"].tap();
target.frontMostApp().mainWindow().buttons()["Pasteboard Sharing"].tap();
UIATarget.localTarget().frontMostApp().mainWindow().buttons()["Paste & Go"]
.tap();
UIATarget.localTarget().pushTimeout(10);
UIATarget.localTarget().frontMostApp().mainWindow().buttons()["Check Pasteboard"]
.withValueForKey(1, "isVisible");
UIATarget.localTarget().popTimeout();
target.frontMostApp().mainWindow().logElementTree();
Appium在後臺也使用UIAutomation。所以限制仍然是一樣的。雖然這適用於Android(帶或不帶appium) –