appium / dotnet-client

Extension to the official Selenium dotnet webdriver
Apache License 2.0
381 stars 187 forks source link

Drag and Drop Issue on C# with winapps #698

Closed Hdddd25 closed 9 months ago

Hdddd25 commented 10 months ago

Hi , I am trying to perform a Drag and drop with following this https://github.com/appium/appium-windows-driver#windows-clickanddrag. I have made that work in Java but I am keep getting " OpenQA.Selenium.WebDriverException : An unknown server-side error occurred while processing the command. Original error: Cannot read properties of null (reading 'match') " issue . Here is my code 👍

public void Task2() { AppiumElement source = (AppiumElement)windowsDriver.FindElement(MobileBy.Name("Q-kan")); AppiumElement destination = (AppiumElement)windowsDriver.FindElement(MobileBy.Name("New Folder1"));

        string startElementId = source.Id;
        string endElementId = destination.Id;

        Point sourceLocation = source.Location;
       int startX = sourceLocation.X;
      int startY = sourceLocation.Y;

        Point destinationLocation = destination.Location;
       int endX = destinationLocation.X;
       int endY = destinationLocation.Y;

        Dictionary<string, object> parameters = new Dictionary<string, object>
{
    { "startX", startX },
    { "startY", startY },
    { "endX", endX },
    { "endY", endY },
    { "startElementId", startElementId },
    { "endElementId", endElementId },
    { "modifierKeys", new string[] { "ctrl" } },
    { "durationMs", 5000 } 
};

        windowsDriver.ExecuteScript("windows:clickAndDrag", parameters);
    }

}

} issue could be related the AppiumElement because in Java I have used RemoteWebElement. I have tried multible element types but all gives the same issues . I have tried WindowsElement ,AppiumWebElement,AppiumWebElement,var... any suggestions on that will be helpful . Thanks

Dor-bl commented 10 months ago

@Hdddd25 Did you checked https://github.com/appium/dotnet-client#winappdriver-notice?

Dor-bl commented 9 months ago

Closed since no response