# I written one python function for UIAutomator i want to test report via robot file how can i pass my python file for testing

**URL:** <https://forum.robotframework.org/t/i-written-one-python-function-for-uiautomator-i-want-to-test-report-via-robot-file-how-can-i-pass-my-python-file-for-testing/5189>\
**Category:** RPA\
**Created:** [19 January 2023 05:46 UTC](https://forum.robotframework.org/t/i-written-one-python-function-for-uiautomator-i-want-to-test-report-via-robot-file-how-can-i-pass-my-python-file-for-testing/5189 "2023-01-19T05:46:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![harishnaitanwar](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/harishnaitanwar/32/2239_2.png) [@harishnaitanwar](https://forum.robotframework.org/u/harishnaitanwar)\
**Post date:** [19 January 2023 05:46 UTC](https://forum.robotframework.org/t/i-written-one-python-function-for-uiautomator-i-want-to-test-report-via-robot-file-how-can-i-pass-my-python-file-for-testing/5189/1 "2023-01-19T05:46:44Z")

</div>

import uiautomator2 as u2  
from time import sleep

def chrome\_testing():  
d=u2.connect()  
d.press(“home”)  
sleep(3)  
# d.press(“camera”)  
# sleep(3)  
# d(resourceId=“com.sec.android.app.camera:id/center\_button\_container”).click()  
d.swipe\_ext(“up”)  
d.xpath(‘//_[@text=“Chrome”]‘).click()  
d(resourceId=“com.android.chrome:id/url\_bar”).click()  
d.clear\_text()  
d.send\_keys(input("enter website what u want hit: "))  
d.send\_action(“search”)  
d(text=“Search YouTube”).click()  
d.send\_keys(input("Enter which song you want to play: "))  
d.send\_action(“search”)  
d.xpath(’//_[@resource-id=“app”]/android.view.View[2]’).click()

chrome\_testing()

This file i want to pass in robot file for testing

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [19 January 2023 06:19 UTC](https://forum.robotframework.org/t/i-written-one-python-function-for-uiautomator-i-want-to-test-report-via-robot-file-how-can-i-pass-my-python-file-for-testing/5189/2 "2023-01-19T06:19:51Z")

</div>

Hi @harishnaitanwar,

Maybe the easiest way is to use [Run](http://robotframework.org/robotframework/latest/libraries/OperatingSystem.html#Run), pass the python executable and script and wait for it to return, same as you would any other executable.

That might not be the best way though as it gives you no detail when there’s a problem

A better way would be to [Create a python keyword](http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#toc-entry-548) then you’ll have more control over what’s returned to the log, but you will need to do some extra python programming.

There are other options too, but from your starting point these are probably the best ones.

Hope that helps,

Dave.
