Skip to content

Commit 3c5ebb7

Browse files
committed
Use new remote endpoint
1 parent 767c7c0 commit 3c5ebb7

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

dotnet/src/webdriver/CookieJar.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,14 @@ public void DeleteAllCookies()
6464

6565
public Cookie GetCookieNamed(string name)
6666
{
67-
Cookie cookieToReturn = null;
68-
if (name != null)
67+
if (name is null)
6968
{
70-
ReadOnlyCollection<Cookie> allCookies = this.AllCookies;
71-
foreach (Cookie currentCookie in allCookies)
72-
{
73-
if (name.Equals(currentCookie.Name))
74-
{
75-
cookieToReturn = currentCookie;
76-
break;
77-
}
78-
}
69+
throw new ArgumentNullException("{nameof(name)}");
7970
}
8071

81-
return cookieToReturn;
72+
var rawCookie = driver.InternalExecute($"{DriverCommand.GetCookie}/{name}", null).Value;
73+
74+
return Cookie.FromDictionary(rawCookie as Dictionary<string, object>);
8275
}
8376

8477
private ReadOnlyCollection<Cookie> GetAllCookies()

0 commit comments

Comments
 (0)