healenium / healenium-appium

Self-healing library for Appium-based tests
Apache License 2.0
26 stars 8 forks source link

After adding SelfHealing wrapper to AndrodDriver Getting exception #37

Open ghost opened 3 years ago

ghost commented 3 years ago

Error

Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: 'GET /source' cannot be proxied to UiAutomator2 server because the instrumentation process is not running (probably crashed) Code

    DesiredCapabilities cap=new DesiredCapabilities();
    cap.setCapability("skipServerInstallation",true);
    cap.setCapability("fullReset",false);
    cap.setCapability("noReset",true);
    cap.setCapability(MobileCapabilityType.DEVICE_NAME,"67853479");
    //cap.setCapability(MobileCapabilityType.AUTOMATION_NAME,"uiautomator2");
    cap.setCapability("appPackage","com.google.android.calculator");
    cap.setCapability("appActivity","com.android.calculator2.Calculator");
    cap.setCapability(MobileCapabilityType.PLATFORM_NAME,"Android");
    cap.setCapability("printPageSourceOnFindFailure",true);
    cap.setCapability("allowTestPackages",true);
    FileInputStream fis = new FileInputStream(path1);
    obj.load(fis);
    config = ConfigFactory.parseProperties(obj);

    AppiumDriver<AndroidElement> driver=new AndroidDriver<AndroidElement>(new 
            URL("http://127.0.0.1:4723/wd/hub"),cap);//here is the connection of server and send the capability to the server
    driver=DriverWrapper.wrap(driver,config);
            return driver;
Gnanendra574 commented 3 years ago

I'm also facing similar issue, while accessing MobileElement

org.openqa.selenium.WebDriverException: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: 'POST /element' cannot be proxied to UiAutomator2 server because the instrumentation process is not running (probably crashed).

             DesiredCapabilities dc = new DesiredCapabilities();
    dc.setCapability("automationName", "UiAutomator2");
    dc.setCapability("deviceName", "emulator-5554");
    dc.setCapability("platformName", "android");
    dc.setCapability("appPackage", "com.divisionsinc.InPosition.beta");
    dc.setCapability("appActivity", "com.divisionsinc.InPosition.MainActivity");
    dc.setCapability(MobileCapabilityType.APP, APKFILEPATH);

    dc.setCapability("test_data:testResultOk:result", "testResultHealed:result");
    dc.setCapability("test_data:testFindElementsOk:digit_7", "testFindElementsHealed:digit_77");
    AppiumDriver driver = new AndroidDriver<AndroidElement>(new URL("http://127.0.0.1:4723/wd/hub"), dc);
    return DriverWrapper.wrap(driver);

Using above driver, initialised page class elements using PageFactory and it's failing on ele.click() with above error.

Alex-Reif commented 2 years ago

Hello @Mitrabhanu-tech , @Gnanendra574 Could you clarify what version of Appium do you use? Recommended version: 1.18

MaheshRamchandra commented 2 years ago

Hi @Aliaksei-Ashukha will Healenium support for Appium studio also????

SureshP8148 commented 2 years ago

Appium Version: v1.22.3 Appium JavaClient: 7.6.0

I too faced this issue. Is anyone has solution for this @Aliaksei-Ashukha

DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("device","emulator-5554"); capabilities.setCapability("platformName", "android"); capabilities.setCapability("automationName", "uiautomator2"); URL url = new URL("http://127.0.0.1:4723/wd/hub"); AppiumDriver driver = new AndroidDriver(url, capabilities); driver = DriverWrapper.wrap(driver); System.out.println("Executed Successfully"); Thread.sleep(10000); driver.findElement(By.xpath("//android.widget.EditText[1]")).sendKeys("userid"); System.out.println("User Name Entered"); driver.findElement(By.xpath("//android.widget.EditText[2]")).sendKeys("123"); System.out.println("Password Entered");

Without DriverWapper it is working fine. When we add the DriverWrappper it got failed with below errors

[main] WARN com.epam.healenium.handlers.proxy.BaseHandler - Error during findElement: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: 'POST /element' cannot be proxied to UiAutomator2 server because the instrumentation process is not running (probably crashed). Check the server log and/or the logcat output for more details Element info: {Using=xpath, value=//android.widget.EditText[1]} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:250) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323) at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:61) at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:428) at io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:151) at io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1) at org.openqa.selenium.By$ByXPath.findElement(By.java:353) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:315) at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:57) at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1) at com.epam.healenium.processor.FindElementProcessor.execute(FindElementProcessor.java:24) at com.epam.healenium.processor.BaseProcessor.process(BaseProcessor.java:41) at com.epam.healenium.handlers.proxy.BaseHandler.findElement(BaseHandler.java:58) at com.epam.healenium.appium.handlers.proxy.MobileSelfHealingProxyInvocationHandler.invoke(MobileSelfHealingProxyInvocationHandler.java:43) at io.appium.javaclient.android.AndroidDriver$$_jvst35e0.findElement(AndroidDriver$$_jvst35e_0.java)