[英]Test if Button Text has changed
I have a button whose text changes based on certain criteria. 我有一个按钮,其文本根据某些条件而变化。 I want to test this functionality with XCUITest
but I can't seem to be able to access the text on the button. 我想使用XCUITest
测试此功能,但似乎无法访问按钮上的文本。
I have tried 我努力了
button.staticTexts
button.value
button.title
elementsQuery.buttons["My Button"] //This uses the accessibility label
How can I access the text? 如何获取文字?
I know this is old but try this: 我知道这很老,但是尝试一下:
let app = XCUIApplication();
let buttonText = app.otherElements["My Button"].staticTexts;
If this doesn't work let me know. 如果这不起作用,请通知我。 Currently working on iOS XCUITests myself 目前正在iOS XCUI上测试自己
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.