SharpAdb / AdvancedSharpAdbClient

AdvancedSharpAdbClient is a .NET library that allows .NET, Mono and Unity applications to communicate with Android devices. It's improved version of SharpAdbClient.
https://sharpadb.github.io
Apache License 2.0
201 stars 54 forks source link

An error occurred while receiving xml: ERROR: null root node returned #84

Closed mrjay59 closed 1 year ago

mrjay59 commented 1 year ago

Describe the bug

I always find this bug when searching for elements

Dim Elspgsuara = Adb.FindElement("//node[@text='Mulai panggilan suara?']") 

for the device image

how to solve it if node is null

Steps to reproduce the bug

Dim elEndC = Adb.FindElement($"//node[@resource-id='com.{whatsapp}:id/footer_end_call_btn']")
If (elEndC Is Nothing) Then
    Dim Elspgsuara = Adb.FindElement("//node[@text='Mulai panggilan suara?']") 'bar ic VOICE

    If Not (Elspgsuara Is Nothing) Then
        Thread.Sleep(500)
        KlikTouch("PAG", whatsapp)
    End If

    Dim Elstpaggil = Adb.FindElement("//node[@text='Pilih tipe panggilan']") 'bar ic VOICE

    If Not (Elstpaggil Is Nothing) Then
        Thread.Sleep(500)
        KlikTouch("PS1", whatsapp)
    End If
End If

Expected behavior

No response

Screenshots

No response

NuGet package version

Latest Source

.NET Platform

.NET Framework 4.5.x

Platform type

Windows

System version

windows 10

IDE

Visual Studio 2015

Additional context

No response

wherewhere commented 1 year ago

@yungd1plomat

yungd1plomat commented 1 year ago

There could be many reasons. Please provide xml from the DumpScreenString method:

var client = new AdbClient();
var device = client.GetDevices().First();
var screen = client.DumpScreenString(device);
await File.WriteAllTextAsync("node.xml", screen);
mrjay59 commented 1 year ago

oke sir