Skip to content

Commit

Permalink
Fixing 'location in view' in .NET bindings for W3C implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
jimevans committed Oct 14, 2015
1 parent 0ea8273 commit b843bc9
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions dotnet/src/webdriver/Remote/RemoteWebElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,20 @@ public Point LocationOnScreenOnceScrolledIntoView
{
get
{
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("id", this.Id);
Response commandResponse = this.Execute(DriverCommand.GetElementLocationOnceScrolledIntoView, parameters);
Dictionary<string, object> rawLocation = (Dictionary<string, object>)commandResponse.Value;
Response commandResponse;
Dictionary<string, object> rawLocation;
if (this.driver.IsSpecificationCompliant)
{
rawLocation = this.driver.ExecuteScript("return arguments[0].getBoundingClientRect();", this) as Dictionary<string, object>;
}
else
{
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("id", this.Id);
commandResponse = this.Execute(DriverCommand.GetElementLocationOnceScrolledIntoView, parameters);
rawLocation = (Dictionary<string, object>)commandResponse.Value;
}

int x = Convert.ToInt32(rawLocation["x"], CultureInfo.InvariantCulture);
int y = Convert.ToInt32(rawLocation["y"], CultureInfo.InvariantCulture);
return new Point(x, y);
Expand Down

0 comments on commit b843bc9

Please sign in to comment.