Sometimes it may be necessary to check if an object is within the bounds of the screen. You can achieve this relatively easy with GameDriver.

Find the screen bounds using GetObjectFieldValue() to access the Screen width and height properties.

Vector2 screenBounds = new Vector2(api.GetObjectFieldValue<int>("fn:type('UnityEngine.Screen')/@width"), api.GetObjectFieldValue<int>("fn:type('UnityEngine.Screen')/@height"));

Find the screen space coordinates of the object.

Vector3 pos = api.GetObjectPosition("//*[@name = 'Player prefab(Clone)']", CoordinateConversion.WorldToScreenPoint);

Now you could check if the object is within the screen bounds by simply comparing the positions.