簡體   English   中英

測試按鈕文本是否已更改

[英]Test if Button Text has changed

我有一個按鈕,其文本根據某些條件而變化。 我想使用XCUITest測試此功能,但似乎無法訪問按鈕上的文本。

我努力了

button.staticTexts
button.value
button.title
elementsQuery.buttons["My Button"] //This uses the accessibility label

如何獲取文字?

我知道這很老,但是嘗試一下:

let app = XCUIApplication();
let buttonText = app.otherElements["My Button"].staticTexts;

如果這不起作用,請通知我。 目前正在iOS XCUI上測試自己

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM