Skip to content

Commit

Permalink
Merge pull request #11 from 2gis/feature/get-element-tag-name
Browse files Browse the repository at this point in the history
Add GetElementTagName command
  • Loading branch information
NickAb committed Feb 27, 2015
2 parents e8b167f + 6de43d7 commit 4a4c9db
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
namespace WindowsUniversalAppDriver.InnerServer
{
#region

using System;
using System.Collections.Generic;
using System.Linq;

using Windows.UI.Xaml;

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

using Windows.UI.Xaml;

using WindowsUniversalAppDriver.Common;
using WindowsUniversalAppDriver.InnerServer.Commands;

#endregion

internal class Automator
{
#region Constructors and Destructors
Expand Down Expand Up @@ -128,6 +132,10 @@ public string ProcessCommand(string content)
{
commandToExecute = new ExecuteCommand();
}
else if (command.Equals(DriverCommand.GetElementTagName))
{
commandToExecute = new GetElementTagNameCommand { ElementId = elementId };
}
else
{
throw new NotImplementedException("Not implemented: " + command);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
namespace WindowsUniversalAppDriver.InnerServer.Commands
{
#region

using WindowsUniversalAppDriver.Common;

#endregion

internal class GetElementTagNameCommand : CommandBase
{
#region Public Properties

public string ElementId { get; set; }

#endregion

#region Public Methods and Operators

public override string DoImpl()
{
var element = this.Automator.WebElements.GetRegisteredElement(this.ElementId);
var tagName = element.GetType().ToString();

return this.JsonResponse(ResponseStatus.Success, tagName);
}

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<Compile Include="Commands\OrientationCommand.cs" />
<Compile Include="Commands\PageSourceCommand.cs" />
<Compile Include="Commands\ScreenCoordinatesHelper.cs" />
<Compile Include="Commands\GetElementTagNameCommand.cs" />
<Compile Include="Commands\TextCommand.cs" />
<Compile Include="Commands\ValueCommand.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
<package>
<metadata>
<id>WindowsUniversalAppDriver.InnerServer</id>
<version>0.1.7</version>
<version>0.1.8</version>
<authors>2GIS</authors>
<owners>2GIS</owners>
<projectUrl>https://github.com/2gis/windows-universal-app-driver</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Inner server. Part of Windows Universal App Driver (Selenium Driver) for automated testing of Windows Universal applications.</description>
<releaseNotes>
Version 0.1.8
+ Add GetElementTagName command (https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/name)
Version 0.1.7
- Fix 'attribute: set' script always throw exceptions
Version 0.1.6
Expand Down

0 comments on commit 4a4c9db

Please sign in to comment.