Forum Xamarin Test Cloud (Read Only)

app.Screenshot(“”) command runs for ever in xamarin UI test

n my automation using Xamarin UI test, the screenshot command is running endlessly. It is taking screen shot and storing it in default folder but the command never ends in execution.

Code :


   public async void Test1()

    // Click on button
    app.Tap(x => x.Class("RelativeLayout"));

    // Click button
    app.Tap(x => x.Class("RelativeLayout"));
    await Task.Delay(3000);

    // Click button
    app.Tap(x => x.Text("Viewpoints"));

    // Select Geometry
    app.Tap(x => x.Text("Geometry"));

    await Task.Delay(10000);

    // screen shot


  • prashantvcprashantvc USXamarin Team Xamurai

    What version of Xamarin.UITest are using? Could you share the sample project demonstrating the issue?

  • NUnit - 2.6.4
    NUnitTestAdapter - 2.1.1
    Xamarin.UI Test - 2.0.9

    I am doing couple of button clicks and then taking screen shot. But I figured out that this is happening if their are any async calls in the test method. With no async calls it is working fine. I was using

    await Task.Delay(5000);

    To wait until map renders to the map view. that creating the problem. currently I replaced it with Thread.Sleep(5000); But it bit strange that it was working fine before and suddenly it is taking long time now.

  • N_BauaN_Baua INMember ✭✭✭✭✭


    Have you tried like this...

    Task waitingfortaskdelay = Task.Delay(3000);
    // DO some stuff here.
    await waitingfortaskdelay;

    I guess the issue is with concurrency between the main and the async thread and both do not want to give up the race :wink:

    Hope this helps.

    N Baua

Sign In or Register to comment.