How to work with JavascriptExecutor in Appium

Viewed 285

I try to work with JavascriptExecutor when I run an automation test in a web application when the test reaches the stage where I need to run JavascriptExecutor I get an error:

org.openqa.selenium.UnsupportedCommandException: Method is not implemented

Before I tried running Appium, I checked that I could run the same test in selenium on the same site where I was trying to run Appium

This is the function:

JavascriptExecutor js = driver;

sleep(2000);
js.executeScript("window.getOutsideInjectedImage = function() {" +
                "console.log('liad Sending');" +
                "const myBlob = new Blob([new Uint8Array(JSON.parse('" + sb.toString() + "')).buffer], {type: 'image/jpg'});" +
                "window.liadBlob = myBlob;" +
                "window.liadSb ='" + sb.toString() + "';" +
                "console.log('liad blob' + myBlob);" +
                "return myBlob;}");

What this function does is, inject an image into the server when the device's camera opens.

0 Answers
Related