Can someone help automate the following scenario?
Scenario: I need to register a user using a QR code generated by the system.
Precondition: I need to automate the step of moving a QR code PNG file into my iOS device gallery before starting the test case.
How can I automate this process?
I have tried many ways;
1st option Mobile.pushFile("device-location",new File("local-machine-file-path"))
2nd option File imageFile=new File("Resources/patients_qr/dev_study_1/client-9923-qr.jpg"); driver.pushFile("/Documents/client-9923-qr.jpg", imageFile)
1 Like
Hi @abeywardhanagsd,
Welcome to our community. Thank you for sharing your issue. I am really familiar with this testing but doing some research, suggest that:
We can use Appium for this. The idea is that we upload QR code PNG to a cloud service (like iCloud, Google Drive, or Dropbox) and note down shared URL or access location for the file. Then we can download the file on iOS device.
Suggested code:
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
// Step 1: Open Safari and navigate to the QR code URL
String qrCodeUrl = "https://your-cloud-service-link.com/qr-code.png"
Mobile.openApplication('com.apple.mobilesafari') // Bundle ID for Safari on iOS
Mobile.tap(findTestObject('Object Repository/Safari_URL_Bar'), 10)
Mobile.setText(findTestObject('Object Repository/Safari_URL_Bar'), qrCodeUrl, 10)
Mobile.tap(findTestObject('Object Repository/Safari_Go_Button'), 10)
// Step 2: Wait for the QR code to load
Mobile.delay(5)
// Step 3: Long-press on the QR code to open the Save Image option
Mobile.longPress(findTestObject('Object Repository/QR_Code_Image'), 3)
// Step 4: Tap on 'Save Image' to save it to the gallery
Mobile.tap(findTestObject('Object Repository/Save_Image_Option'), 10)
// Step 5: Close Safari
Mobile.closeApplication()
We can verify the photo in the gallery:
Mobile.openApplication('com.apple.mobileslideshow') // Photos app bundle ID
There might be other options like using simulator where you can place files directly in the simulator’s gallery using tools like xcrun simctl
.
Please take a look and do more research on this
Hi Sandun @abeywardhanagsd, 
It’s been a while since we saw you on the forum.
Could you let us know whether Elly’s suggestion was able to help you or not?
If yes, then could you help to mark her reply as a solution
, so that other members can refer to it in the future?
If not, then please remember to follow up with other members so you can work towards a solution together.
Thanks,
Albert