Search code examples
appiumselendroidandroid-uiautomator

Is there any way to automate scanning of barcode from appium?


I require my app to Scan barcode automatically , i have the barcodes, i have the app required, how can i make the App read physical bar codes using automation in appium,

In manual i can scan the code by pointing out the camera to an bar code. I dont know how to do it while executing an test suite. i got idea of placing Mobile device on an Stand, tripod and placing barcode in front of it. But the problem is we can test only one barcode. i want to run for about 100-200 barcodes ans see app performance does not decrease, can any one suggest some ways?


Solution

  • This is a very interesting case. If you really want to test your app scanning the bar codes through camera then I think instead of looking for a solution through appium you have to look for a solution to exactly match your manual process.

    You can click scan button using appium(I assume) - for example you can write a script to click on this button every 10 seconds. Challenge is to point the camera to the next barcode as soon as first scan is complete. Possible solutions- I believe that all the bar codes can be captured in a file in a pc. Copy these bar code images in a ppt or using any other program so that these images can automatically displayed one by one. Put your device in front of this pc as you are already planning to use tripod stand etc. Focus them on screen(may be first time you might need to do all these adjustments). Run your script. Do some trial runs. Synchronize the process with correct time outs. I think this should be feasible though really not the best way to automate this scenario.