Not able to set text in any android mobile app in cloud agent Browserstack

Hi Team,

I am trying to do automation around uber app using automation tool written in C# and tried to set text in one of its fields. unfortunately, I am not able to perform this operation and tried to set the text in other android app like LinkedIn and amazon too, there also I am not able to perform this operation.

In contrast with, we are using similar code to set text for other cloud agent like Saucelab, there I am able to perform this operation successfully.

As i debugged my code, i found an exception in line executor.Driver.SwitchTo().ActiveElement(); under the function TrySwitchToActiveElement()

below is my code.

protected override bool Execute(TExecutor executor)
{
#region execution
var element = executor.TryGetElementFromCache(elementId)?.AppiumElement;

if (element != null)
{
    if (options.NeedTapBefore)
    {
        if (TryTapAndSwitchToActiveElement(executor, ref element) == false)
        {
            return TrySetTextUsingKeyboard(executor);
        }
    }

    if (TrySetTextToElement(executor, element) == false)
    {
        return TrySetTextUsingKeyboard(executor);
    }
    else
	{
        return true;
	}
}
#endregion execution

#region recording
if (TrySwitchToActiveElement(executor, ref element))
{
    return TrySetTextToElement(executor, element);
}
else if (options.NeedTapBefore)
{
    return TrySetTextUsingKeyboard(executor);
}
#endregion recording

return false;

}

private bool TryTapAndSwitchToActiveElement(TExecutor executor, ref IWebElement element)
{
if (TryTapElement(executor, element))
{
return TrySwitchToActiveElement(executor, ref element);
}

return false;

}

private bool TryTapElement(TExecutor executor, IWebElement element)
{
try
{
element.Click();

    return true;
}
catch (Exception ex)
{
    executor.Log.Error(ex);

    return false;
}

}

private bool TrySwitchToActiveElement(TExecutor executor, ref IWebElement element)
{
try
{
element = executor.Driver.SwitchTo().ActiveElement();

    return true;
}
catch (NoSuchElementException ex)
{
    executor.Log.Error(ex, $"There is no active mobile element to set text");
}
catch (Exception ex)
{
    executor.Log.Error(ex);
}

return false;

}

kindly assist me

@Aleksei could you please assist me on this ?

Make it more simple - just tap on element input and send text or type with keayboard.

let me try this and let you know the result