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

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

Hi @harishnaitanwar,

Maybe the easiest way is to use 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 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.