I am getting the same issue.
I tried changing the context to native just before the perform call it gave me an error : -
UnreachableBroswerException : Error communicating with the remote browser. It may have died.
I assume your solution won’t work in my scenario. Can you help me. Is there any other solution? What I am doing wrong?
Please check my post