ExecuteScript in xamarin app

Mobile Testing, Android App Testing.
dkmpbrt
Posts: 10
Joined: Thu Jan 25, 2018 9:00 am

ExecuteScript in xamarin app

Post by dkmpbrt » Thu May 28, 2020 7:39 am

Hey,

Is there a way to inject javascript into a xamarin-app?
For browser, I use

Code: Select all

webDocument.executeScript("console.log('hello world');");
and that works. But that doesn't seem to work for a xamarin app.

When I even just define the webdocument, like this:

Code: Select all

Ranorex.WebDocument webDoc = "//dom[@dom>='domainhere']";
and I run this the first time, the app crashes, the 2nd time I run it, everything works.

Funny thing is, that when I run it while the Ranorex Spy is open, it doesn't crash the first time either and it works everytime

Kind regards,
Bart

foals11
Posts: 20
Joined: Wed Sep 18, 2019 9:19 am

Re: ExecuteScript in xamarin app

Post by foals11 » Fri May 29, 2020 10:12 am

Hi Bart,

What Ranorex version do you use?
I had a similar issue, in my case it helped to add a delay after the run application action.
Set the delay to something like two minutes, just to see if it helps.

regards,

dkmpbrt
Posts: 10
Joined: Thu Jan 25, 2018 9:00 am

Re: ExecuteScript in xamarin app

Post by dkmpbrt » Tue Jun 02, 2020 9:52 am

Hi foals11,

At the moment, we are using version 9.1.2.

I've tried adding a delay after the run mobile app, but that doesn't seem to work :(

I've also noticed the "rxid" attribute is only available after the first crash. So i think this is a pure Ranorex bug?

Kr,
Bart

dkmpbrt
Posts: 10
Joined: Thu Jan 25, 2018 9:00 am

Re: ExecuteScript in xamarin app

Post by dkmpbrt » Fri Jun 05, 2020 12:26 pm

It also seems to be crashing only on Android. On iOS it works fine.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6190
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: ExecuteScript in xamarin app

Post by odklizec » Fri Jun 05, 2020 12:45 pm

Hi,

Your best chance is to try Ranorex 9.3.2 and hope for the best. Of course, you need to instrument the app with new version.

There were released 5 Ranorex versions since 9.1.2, with great number of Android bug fixes and improvements. Using 9.3.2 may or may not help with your particular problme, but the first thing Ranorex support will ask you to do is to try it with most recent Ranorex version ;) So please try it with 9.3.2. And if it does not fix the crash, contact Ranorex support.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration