Skip to content

Commit b72a1ff

Browse files
committed
Temporarily reverting to prior verion of Window manipulation protocol
The getWindowRect protocol end points are not yet implemented by any remote-end implementation that follows the W3C specification. For the moment, revert back to the older get/set size and position end points until remote ends are brought up to date with the current spec.
1 parent fa68af7 commit b72a1ff

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

dotnet/src/webdriver/Remote/RemoteWindow.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ public Point Position
5050
Response commandResponse;
5151
if (this.driver.IsSpecificationCompliant)
5252
{
53-
commandResponse = this.driver.InternalExecute(DriverCommand.GetWindowRect, null);
53+
// TODO: Remove window size/position end points when spec-compliant remote ends have
54+
// migrated to the window rect commands.
55+
// commandResponse = this.driver.InternalExecute(DriverCommand.GetWindowRect, null);
56+
commandResponse = this.driver.InternalExecute(DriverCommand.GetWindowPosition, null);
5457
}
5558
else
5659
{
@@ -72,7 +75,10 @@ public Point Position
7275
parameters.Add("y", value.Y);
7376
if (this.driver.IsSpecificationCompliant)
7477
{
75-
this.driver.InternalExecute(DriverCommand.SetWindowRect, parameters);
78+
// TODO: Remove window size/position end points when spec-compliant remote ends have
79+
// migrated to the window rect commands.
80+
// this.driver.InternalExecute(DriverCommand.SetWindowRect, parameters);
81+
this.driver.InternalExecute(DriverCommand.SetWindowPosition, parameters);
7682
}
7783
else
7884
{
@@ -93,7 +99,10 @@ public Size Size
9399
Response commandResponse;
94100
if (this.driver.IsSpecificationCompliant)
95101
{
96-
commandResponse = this.driver.InternalExecute(DriverCommand.GetWindowRect, null);
102+
// TODO: Remove window size/position end points when spec-compliant remote ends have
103+
// migrated to the window rect commands.
104+
// commandResponse = this.driver.InternalExecute(DriverCommand.GetWindowRect, null);
105+
commandResponse = this.driver.InternalExecute(DriverCommand.GetWindowSize, null);
97106
}
98107
else
99108
{
@@ -115,7 +124,10 @@ public Size Size
115124
parameters.Add("height", value.Height);
116125
if (this.driver.IsSpecificationCompliant)
117126
{
118-
this.driver.InternalExecute(DriverCommand.SetWindowRect, parameters);
127+
// TODO: Remove window size/position end points when spec-compliant remote ends have
128+
// migrated to the window rect commands.
129+
// this.driver.InternalExecute(DriverCommand.SetWindowRect, parameters);
130+
this.driver.InternalExecute(DriverCommand.SetWindowSize, parameters);
119131
}
120132
else
121133
{

dotnet/src/webdriver/Remote/W3CWireProtocolCommandInfoRepository.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,16 @@ protected override void InitializeCommandDictionary()
6464
this.TryAddCommand(DriverCommand.GetWindowHandles, new CommandInfo(CommandInfo.GetCommand, "/session/{sessionId}/window/handles"));
6565
this.TryAddCommand(DriverCommand.SwitchToFrame, new CommandInfo(CommandInfo.PostCommand, "/session/{sessionId}/frame"));
6666
this.TryAddCommand(DriverCommand.SwitchToParentFrame, new CommandInfo(CommandInfo.PostCommand, "/session/{sessionId}/frame/parent"));
67+
68+
// TODO: Remove window size/position end points when spec-compliant remote ends have
69+
// migrated to the window rect commands.
70+
this.TryAddCommand(DriverCommand.GetWindowSize, new CommandInfo(CommandInfo.GetCommand, "/session/{sessionId}/window/size"));
71+
this.TryAddCommand(DriverCommand.SetWindowSize, new CommandInfo(CommandInfo.PostCommand, "/session/{sessionId}/window/size"));
72+
this.TryAddCommand(DriverCommand.GetWindowPosition, new CommandInfo(CommandInfo.GetCommand, "/session/{sessionId}/window/position"));
73+
this.TryAddCommand(DriverCommand.SetWindowPosition, new CommandInfo(CommandInfo.PostCommand, "/session/{sessionId}/window/position"));
6774
this.TryAddCommand(DriverCommand.GetWindowRect, new CommandInfo(CommandInfo.GetCommand, "/session/{sessionId}/window/rect"));
6875
this.TryAddCommand(DriverCommand.SetWindowRect, new CommandInfo(CommandInfo.PostCommand, "/session/{sessionId}/window/rect"));
76+
6977
this.TryAddCommand(DriverCommand.MaximizeWindow, new CommandInfo(CommandInfo.PostCommand, "/session/{sessionId}/window/maximize"));
7078
this.TryAddCommand(DriverCommand.MinimizeWindow, new CommandInfo(CommandInfo.PostCommand, "/session/{sessionId}/window/minimize"));
7179
this.TryAddCommand(DriverCommand.FullScreenWindow, new CommandInfo(CommandInfo.PostCommand, "/session/{sessionId}/window/fullscreen"));

0 commit comments

Comments
 (0)