SimulateCapture method doesnt work

Hi Team,
I have been using Appium Studio for testing my IOS application and the tool works really good for all my requirements.

But i have one scenario where in , on click of a button in the app, it opens scanner(Cognex scanner) to scan barcodes and process the result . For this we have used SimulateCapture method to preview barcode image to the scanner but the app is not able to scan the mocked barcode image.

The above process works when we test it manually.

Can you please help me with the above issue , so that i can work with simulateCapture Method? Else can you suggest me the scanner that i can use with Appium Studio and simulate scanning functionality?

Please note, the app is Instrumented by using manual process in this link https://docs.experitest.com/display/TD/SeeTestAutomation+-+Manually+Instrumenting+iOS+Applications

We have added this line to app.properties
instrumentation.use_new_instrumentation=true

Please find my code as below

public class BaseAppiumIOS {
private String reportDirectory = “reports”;
private String reportFormat = “xml”;
private String testName = “Untitled”;
protected IOSDriver driver = null;

private SeeTestClient client;

private String sotFileTEST1="C:\\\\Users\\\\ap250532\\\\Desktop\\\\sot01.JPG";


DesiredCapabilities dc = new DesiredCapabilities();

@Before
public void setUp() throws MalformedURLException {
	  dc.setCapability("reportDirectory", reportDirectory);
      dc.setCapability("reportFormat", reportFormat);
      dc.setCapability("testName", testName);

      dc.setCapability("android.instrumentation.camera", true);
      dc.setCapability("android.instrumentation.security", true);
      
      dc.setCapability(MobileCapabilityType.UDID, "375fb0d5b0fd03df3c73c98bbc3d9040f7988320");
      
      dc.setCapability("instrumentApp", false);
      
      
      driver = new IOSDriver<>(new URL("http://localhost:4723/wd/hub"), dc);
      driver.setLogLevel(Level.INFO);

	  driver.executeScript("seetest:client.install(\"C:\\\\Users\\\\ap250532\\\\Desktop\\\\MyiScanEnterprise.ipa\", \"false\", \"true\")");        
	  driver.executeScript("seetest:client.launch(\"com.ncr.flms.mrmerchant.enterprise\", \"false\", \"true\")");

    client = new SeeTestClient(driver);

}

@Test
public void testUntitled() {
	
	
	driver.findElement(By.xpath("//*[@text='Scan customer card']")).click();


    	client.simulateCapture("");
    	client.simulateCapture(sotFileTEST1);
	

	new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@accessibilityLabel='Accept']")));

}

@After
public void tearDown() {
driver.quit();
}
}

Hi @ambaji.patangay,

What error message is it throwing?

Can you change dc.setCapability(“instrumentApp”, false); to dc.setCapability(“instrumentApp”, true);

Additionally, can you use simulateCapture before opening the Scanner. iOS is expecting image injection before opening Scanner/Camera.

If the above does not work, it may have to do with compatibility issue. The simulateCapture capability we provide is based on sets of standard libraries, and sometimes developers will implement a different library which we may not recognize. But that is another story, could you try the above suggested approach?

Hi Rahee,
It does’nt log any error , but its not able to scan the barcode which i am trying to simulate.

As suggested by you i have made the below changes

->
dc.setCapability(“instrumentApp”, true);

      driver.executeScript("seetest:client.install(\"C:\\\\Users\\\\ap250532\\\\Desktop\\\\MyiScanEnterprise.ipa\", \"true\", \"true\")");
    driver.executeScript("seetest:client.launch(\"com.ncr.flms.mrmerchant.enterprise\", \"true\", \"true\")");

-> I have used simulateCapture before opening the Scanner but of no use.

Can you please let me know the scanner which you have used for testing(like Zebra, Cognex, Zing etc…)? So i can use the same in my app and acheive the expected result.