1

I'm looking for a JS way to detect if a click (on a WebView) was emulated by an automated test. Reading this stack-overflow post about selenium detection was my initial starting point.

I've created a simple Appium test:

driver.init({
    browserName: '',
    'appium-version': '1.8.1',
    platformName: 'Android',
    device:"Android",
    deviceName: 'Android'
    app: "path/to/my.apk"
  }).catch((e)=>{
    console.error("ERROR",e);
  }).setImplicitWaitTimeout(3000).then(()=>{
    setTimeout(()=>{
      console.log("Clicking");
      let webView = driver.elementByClassName("android.webkit.WebView",()=>{});
      webView.click();
    },3000);
  });

The only thing I could spot was that clientX, clientY on the JS event was always the same. I assume there is a way to emulate different x and y by code.

So my question is: Is there a way to detect Appium using only the JS running in the WebView?

Shlomi Schwartz
  • 8,693
  • 29
  • 109
  • 186

0 Answers0