healenium / healenium-appium

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

Self Healing not working , when locator change getting null pointer exception at the time of healing #30

Open ashish143ti opened 3 years ago

ashish143ti commented 3 years ago

Hi @Aliaksei-Ashukha

I am using Healenium Appium 1.2 version , I have created baseline first and tested this solution with application modification (locator change) , here I have found Self Healing is not working . Kindly do the needful as earliest as possible .

Please find my below logs , at the time of healing getting null pointer exception from Healenium -

Aug 31, 2021 3:52:19 PM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0 INFO: Detected dialect: W3C Aug 31, 2021 3:52:34 PM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0 INFO: Detected dialect: W3C [main] INFO com.epam.healenium.appium.ProxyMethodHandler -

[main] INFO com.epam.healenium.SelfHealingEngine - savePath start: 15:52:44.785 [main] INFO com.epam.healenium.data.FileSystemPathStorage - persistLastValidPath start: 15:52:47.318 [main] INFO com.epam.healenium.data.FileSystemPathStorage - persistLastValidPath finish: 15:52:47.382 [main] INFO com.epam.healenium.SelfHealingEngine - savePath finish: 15:52:47.382 [main] WARN com.epam.healenium.appium.ProxyMethodHandler - Failed to find an element using locator By.xpath: (//*[contains(@text , '1211')])[1] Reason: An element could not be located on the page using the given search parameters. For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'LAPTOP-PSPSHCRD', ip: '192.168.1.10', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_241' Driver info: io.appium.java_client.android.AndroidDriver Capabilities {appActivity: com.cc.contactscreator.Main..., appPackage: com.cc.contactscreator, databaseEnabled: false, desired: {appActivity: com.cc.contactscreator.Main..., appPackage: com.cc.contactscreator, deviceName: Pixel 3 API 27, platformName: android, platformVersion: 11.0, test_data:testFindElementsOk:digit_7: testFindElementsHealed:digi..., test_data:testResultOk:result: testResultHealed:result, udid: emulator-5554}, deviceApiLevel: 27, deviceManufacturer: Google, deviceModel: Android SDK built for x86, deviceName: emulator-5554, deviceScreenDensity: 440, deviceScreenSize: 1080x2160, deviceUDID: emulator-5554, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, pixelRatio: 2.75, platform: LINUX, platformName: Android, platformVersion: 8.1.0, statBarHeight: 66, takesScreenshot: true, test_data:testFindElementsOk:digit_7: testFindElementsHealed:digi..., test_data:testResultOk:result: testResultHealed:result, udid: emulator-5554, viewportRect: {height: 1962, left: 0, top: 66, width: 1080}, warnings: {}, webStorageEnabled: false} Session ID: cbab64e8-05ae-4beb-9912-7763932ed13a ** Element info: {Using=xpath, value=(//[contains(@text , '1211')])[1]} Trying to heal... [main] INFO com.epam.healenium.appium.ProxyMethodHandler - locator.hashCode of By.xpath: (//*[contains(@text , '1211')])[1] = -567413804 [main] WARN com.epam.healenium.appium.ProxyMethodHandler - Using healed locator: By.xpath: //android.widget.EditText[@resource-id = 'com.cc.contactscreator:id/et_count'] [main] WARN com.epam.healenium.appium.ProxyMethodHandler - Other choice: By.xpath: //android.widget.EditText[@resource-id = 'com.cc.contactscreator:id/et_mobile'] [main] WARN com.epam.healenium.appium.ProxyMethodHandler - Other choice: By.xpath: //android.widget.LinearLayout[@resource-id = 'com.cc.contactscreator:id/ll2'] Exception in thread "main" java.lang.NullPointerException at java.util.Objects.requireNonNull(Objects.java:203) at java.nio.file.Files.copy(Files.java:2984) at com.epam.healenium.data.FileSystemPathStorage.saveLocatorInfo(FileSystemPathStorage.java:121) at com.epam.healenium.SelfHealingEngine.saveLocator(SelfHealingEngine.java:78) at com.epam.healenium.appium.ProxyMethodHandler.lambda$heal$0(ProxyMethodHandler.java:181) at java.util.Optional.map(Optional.java:215) at com.epam.healenium.appium.ProxyMethodHandler.heal(ProxyMethodHandler.java:178) at com.epam.healenium.appium.ProxyMethodHandler.findElement(ProxyMethodHandler.java:112) at com.epam.healenium.appium.ProxyMethodHandler.invoke(ProxyMethodHandler.java:77) at io.appium.javaclient.android.AndroidDriver$$_jvst3fd0.findElementByXPath(AndroidDriver$$_jvst3fd_0.java) at mvn_demo.healenium.demos.main(demos.java:53)

AnatoliZaitsau commented 3 years ago

Thank you for the information, we need some time to investigate

ghost commented 3 years ago

@ashish143ti: can you give your code as i have created a maven project ,while iam running iam getting nosuch method error typeConfig issue

ashish143ti commented 3 years ago

Hi @Mitrabhanu-tech ,

I didn't get such issue at the time of Appium integration , I guess you are getting this issue due to type safe (jar) version conflict issue or instead of using healenium appium 1.2 maven dependancy you have directly imported healenium appium jar in to your project, kindly use maven dependancy of healenium appium 1.2 , in case you are already using healenium appium dependancy than remove existing type safe config maven dependency or declare below dependency in pom.xml .

com.typesafe config 1.4.1
ashish143ti commented 3 years ago

@Mitrabhanu-tech - I have tested this solution closely and found self healing not working , hoping Healenium team will fix this major bug in upcoming days .

ghost commented 3 years ago

@ashish143ti :is your application invoking mutltiple times in mobile