Appium + Robot Framework: Timeout switching to context

Hi guys,
I’m running a test on a social account login case (google) in hybrid app using Appium and Robot framework as Appium Client. I was unable to switch context due to some problem with connection.
I’ll leave some details about this issue below, please help me figure this out.

1. Prerequisite

2. Step to Reproduce

  • Capabilities:
    … remote_url=http://localhost:4723/wd/hub
    … alias=myApp
    … platformName=Android
    … platformVersion=9
    … deviceName=
    … appPackage=${APP_PACKAGE}
    … appActivity=${APP_ACTIVITY}
    … automationName=UiAutomator2
    … fullContextList=true
    … ensureWebviewsHavePages=true
    … showChromedriverLog=true

  • Code:
    AppiumLibrary.Wait Until Page Contains Element xpath=//android.webkit.WebView timeout=20
    ${contexts}= Get Contexts
    ${context}= Get From List ${contexts} 1
    Switch To Context ${context}

3. Error

  • After pending on the Switch To Context for a while, the error produced as : ProtocolError: (‘Connection aborted.’, RemoteDisconnected(‘Remote end closed connection without response’))
  • I checked Appium Log, here’s a snippet:

I’ve been seeking for a solution and nothing came up so far. Please help, thanks!