[misc-uiautomation] extract some common steps into libiary