locked
How to fetch an element's font size in Ui-Test? RRS feed

  • Question

  • User392365 posted

    I want to get the Font size of an element in a Ui-Test.

    var deviceIDFontSize = App.Query(thisObject =>thisObject .Id("deviceID").Invoke("getFontFeatureSettings"))[0]; Console.WriteLine("deviceIDFontSize: " + deviceID_FontSize ); The element is found and the test is not getting failed. But the output is null. I am not sure if using "getFontFeatureSettings" method is proper or not.

    Please let me know what needs t o be corrected, to get the proper output.

    Thanks in advance :)

    Wednesday, January 22, 2020 5:35 AM

All replies

  • User382871 posted

    Which control's font size do you want to get? For native Android, you can get the value using getFontSize method. And the Invoke uses Java method, try the following code: var deviceID_FontSize = App.Query(thisObject =>thisObject .Id("deviceID").Invoke("getFontSize"))[0]; Console.WriteLine("deviceID_FontSize: " + deviceID_FontSize );

    Tutorial: https://docs.microsoft.com/en-us/appcenter/test-cloud/uitest/cheatsheet#invoke-a-method-on-an-appresult-or-ui-element

    Wednesday, January 22, 2020 8:34 AM