Skip to content

Commit 22386f6

Browse files
authored
[dotnet] change source of navigation alias (#13960)
[dotnet] have url property setter call navigation method instead of the other way around
1 parent 7f67d6e commit 22386f6

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

dotnet/src/webdriver/Navigator.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// </copyright>
1818

1919
using System;
20+
using System.Collections.Generic;
2021

2122
namespace OpenQA.Selenium
2223
{
@@ -58,7 +59,17 @@ public void Forward()
5859
/// <param name="url">String of where you want the browser to go to</param>
5960
public void GoToUrl(string url)
6061
{
61-
this.driver.Url = url;
62+
if (url == null)
63+
{
64+
throw new ArgumentNullException(nameof(url), "URL cannot be null.");
65+
}
66+
67+
Dictionary<string, object> parameters = new Dictionary<string, object>
68+
{
69+
{ "url", url }
70+
};
71+
this.driver.InternalExecute(DriverCommand.Get, parameters);
72+
6273
}
6374

6475
/// <summary>
@@ -72,7 +83,7 @@ public void GoToUrl(Uri url)
7283
throw new ArgumentNullException(nameof(url), "URL cannot be null.");
7384
}
7485

75-
this.driver.Url = url.ToString();
86+
this.GoToUrl(url.ToString());
7687
}
7788

7889
/// <summary>

dotnet/src/webdriver/WebDriver.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,7 @@ public string Url
109109
return commandResponse.Value.ToString();
110110
}
111111

112-
set
113-
{
114-
if (value == null)
115-
{
116-
throw new ArgumentNullException(nameof(value), "Argument 'url' cannot be null.");
117-
}
118-
119-
Dictionary<string, object> parameters = new Dictionary<string, object>();
120-
parameters.Add("url", value);
121-
this.Execute(DriverCommand.Get, parameters);
122-
}
112+
set => new Navigator(this).GoToUrl(value);
123113
}
124114

125115
/// <summary>

0 commit comments

Comments
 (0)