Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotate throw System.NotImplementedException #755

Closed
ptittof57 opened this issue Mar 11, 2024 · 7 comments · Fixed by #756
Closed

Rotate throw System.NotImplementedException #755

ptittof57 opened this issue Mar 11, 2024 · 7 comments · Fixed by #756
Labels

Comments

@ptittof57
Copy link

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

  • .NET client build version or git revision if you use some snapshot: Appium.WebDriver - 5.0.0-rc.6
  • Appium server version or git revision if you use some snapshot: 2.4.1
  • Desktop OS/version used to run Appium if necessary: MacOs Sonoma 14.3.1
  • Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: 20.11.1
  • Mobile platform/version under test: Android (API28) and iOS (iPhone 15 Pro iOS 17.2)
  • Real device or emulator/simulator: both Android and iOS simulators

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
Copy link
Member

Could you share the appium server log as well? I assume

public const string SetOrientation = "setOrientation";
would work for now

@Dor-bl
Copy link
Collaborator

Dor-bl commented Mar 12, 2024

@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
Copy link
Member

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
Copy link
Collaborator

Dor-bl commented Mar 12, 2024

@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
Copy link
Member

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

@Dor-bl
Copy link
Collaborator

Dor-bl commented Mar 12, 2024

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
Copy link

mykola-mokhnach commented Mar 12, 2024

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

  • Orientation is limited. It only supports portrait and landscape, while rotation supports various angles (in reality for iOS and Android it adds two more possible states)
  • Rotation (and orientation) are not applicable for all drivers

@Dor-bl Dor-bl linked a pull request Mar 12, 2024 that will close this issue
6 tasks
@Dor-bl Dor-bl added the NotABug label Mar 12, 2024
@Dor-bl Dor-bl changed the title [Bug]: Rotate throw System.NotImplementedException Rotate throw System.NotImplementedException Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants