appium / dotnet-client

Extension to the official Selenium dotnet webdriver
Apache License 2.0
373 stars 186 forks source link

Rotate throw System.NotImplementedException #755

Closed ptittof57 closed 3 months ago

ptittof57 commented 4 months ago

Description

Hello,

I try to perfom a device rotation with the following code:

    [Test]
    public void RotationTest()
    {
        var rotation90Degrees = new Dictionary<string, int>
        {
            { "rotation", 90 },
        };

        this.Driver.Rotate(rotation90Degrees);

        Assert.IsTrue(this.Driver.Orientation == ScreenOrientation.Landscape);
    }

But I receive an exception.

Environment

Exception stack traces

Exception has occurred: CLR/System.NotImplementedException An exception of type 'System.NotImplementedException' occurred in WebDriver.dll but was not handled in user code: 'The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource' at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute) at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Appium.AppiumDriver.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Appium.AppiumDriver.Rotate(Dictionary2 opts) at UITests.DashboardTest.RotationTest()

Let me know if I am doing something wrong or if this feature is not implemented yet. Thanks

KazuCocoa commented 3 months ago

Could you share the appium server log as well? I assume https://github.com/appium/dotnet-client/blob/23ae815afb74e51172b15dbc6a1558387ed021f8/src/Appium.Net/Appium/AppiumDriverCommand.cs#L289 would work for now

Dor-bl commented 3 months ago

@ptittof57 This should do the trick

            _driver.Orientation = ScreenOrientation.Landscape;
            Assert.That(_driver.Orientation == ScreenOrientation.Landscape);

@KazuCocoa I deprecate the rotate method? what's the status of other appium clients?

KazuCocoa commented 3 months ago

The rotate does not have much usage, and it is not w3c. It is safe to remove it I think. Python and Ruby clients do not have the rotation endpoint call. Java still has. They have the orientation endpoint call.

Dor-bl commented 3 months ago

@KazuCocoa Any idea what Rotate on Element is supposed to do? Maybe it's a mistake. Anyway, I'm getting for this one System.NotImplementedException: 'Method has not yet been implemented' as well https://github.com/appium/dotnet-client/blob/main/src/Appium.Net/Appium/AppiumElement.cs#L199-L208

KazuCocoa commented 3 months ago

Perhaps it is for https://github.com/appium/appium/pull/19379 . The implementation did not exist on current drivers. Thus, I removed that endpoint.

Dor-bl commented 3 months ago

Perhaps it is for appium/appium#19379 . The implementation did not exist on current drivers. Thus, I removed that endpoint.

Great, so it's safe to remove this method as well and the related endpoint on our side

mykola-mokhnach commented 3 months ago

I'd say rotation could be implemented as an extension method. Also, to add on that: