Skip to content
Snippets Groups Projects
Commit 24147496 authored by svatal's avatar svatal
Browse files
protocol conflicts resolved using master - regeneration needed
parents 3207391a f37da538
No related branches found
No related tags found
No related merge requests found
Showing
with 290 additions and 78 deletions
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace MasterDevs.ChromeDevTools
{
public class ChromeProcess : IChromeProcess
{
public DirectoryInfo UserDirectory { get; set; }
public Process Process { get; set; }
public string RemoteDebuggingUri { get; set; }
public void Dispose()
{
Process.Kill();
try
{
UserDirectory.Delete(true);
}
catch
{
Thread.Sleep(500); // i'm being lazy because i'm tired
UserDirectory.Delete(true);
}
}
public async Task<string[]> GetSessions()
{
var remoteSessionUrls = new List<string>();
var webClient = new HttpClient();
var uriBuilder = new UriBuilder(RemoteDebuggingUri);
uriBuilder.Path = "/json";
var remoteSessions = await webClient.GetStringAsync(uriBuilder.Uri);
using (var stringReader = new StringReader(remoteSessions))
using (var jsonReader = new JsonTextReader(stringReader))
{
var sessionsObject = JToken.ReadFrom(jsonReader) as JArray;
foreach (var sessionObject in sessionsObject)
{
var sessionUrl = sessionObject["webSocketDebuggerUrl"].GetSafeString();
if (!String.IsNullOrEmpty(sessionUrl))
{
remoteSessionUrls.Add(sessionUrl);
}
}
}
return remoteSessionUrls.ToArray();
}
}
}
\ No newline at end of file
using System.Diagnostics; using System;
using System.Diagnostics;
using System.IO; using System.IO;
namespace MasterDevs.ChromeDevTools namespace MasterDevs.ChromeDevTools
...@@ -14,12 +15,9 @@ namespace MasterDevs.ChromeDevTools ...@@ -14,12 +15,9 @@ namespace MasterDevs.ChromeDevTools
var chromeProcessArgs = remoteDebuggingArg + " " + userDirectoryArg + " --bwsi --no-first-run"; var chromeProcessArgs = remoteDebuggingArg + " " + userDirectoryArg + " --bwsi --no-first-run";
var processStartInfo = new ProcessStartInfo(@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", chromeProcessArgs); var processStartInfo = new ProcessStartInfo(@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", chromeProcessArgs);
var chromeProcess = Process.Start(processStartInfo); var chromeProcess = Process.Start(processStartInfo);
return new ChromeProcess
{ string remoteDebuggingUrl = "http://localhost:" + port;
Process = chromeProcess, return new LocalChromeProcess(new Uri(remoteDebuggingUrl), directoryInfo, chromeProcess);
UserDirectory = directoryInfo,
RemoteDebuggingUri = "http://localhost:" + port
};
} }
} }
} }
\ No newline at end of file
...@@ -3,6 +3,11 @@ namespace MasterDevs.ChromeDevTools ...@@ -3,6 +3,11 @@ namespace MasterDevs.ChromeDevTools
{ {
public class ChromeSessionFactory : IChromeSessionFactory public class ChromeSessionFactory : IChromeSessionFactory
{ {
public IChromeSession Create(ChromeSessionInfo sessionInfo)
{
return Create(sessionInfo.WebSocketDebuggerUrl);
}
public IChromeSession Create(string endpointUrl) public IChromeSession Create(string endpointUrl)
{ {
// Sometimes binding to localhost might resolve wrong AddressFamily, force IPv4 // Sometimes binding to localhost might resolve wrong AddressFamily, force IPv4
......
namespace MasterDevs.ChromeDevTools
{
public class ChromeSessionInfo
{
public string Description { get; set; }
public string DevtoolsFrontendUrl { get; set; }
public string Id { get; set; }
public string Title { get; set; }
public string Type { get; set; }
public string Url { get; set; }
public string WebSocketDebuggerUrl { get; set; }
}
}
\ No newline at end of file
using System; using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace MasterDevs.ChromeDevTools namespace MasterDevs.ChromeDevTools
{ {
public interface IChromeProcess : IDisposable public interface IChromeProcess : IDisposable
{ {
Task<string[]> GetSessions(); Task<ChromeSessionInfo[]> GetSessionInfo();
DirectoryInfo UserDirectory { get; } Task<ChromeSessionInfo> StartNewSession();
Process Process { get; } Uri RemoteDebuggingUri { get; }
string RemoteDebuggingUri { get; }
} }
} }
\ No newline at end of file
using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
namespace MasterDevs.ChromeDevTools
{
public class LocalChromeProcess : RemoteChromeProcess
{
public LocalChromeProcess(Uri remoteDebuggingUri, DirectoryInfo userDirectory, Process process)
: base(remoteDebuggingUri)
{
UserDirectory = userDirectory;
Process = process;
}
public DirectoryInfo UserDirectory { get; set; }
public Process Process { get; set; }
public override void Dispose()
{
base.Dispose();
Process.Kill();
try
{
UserDirectory.Delete(true);
}
catch
{
Thread.Sleep(500); // i'm being lazy because i'm tired
UserDirectory.Delete(true);
}
}
}
}
\ No newline at end of file
...@@ -60,10 +60,11 @@ ...@@ -60,10 +60,11 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ChromeProcessFactory.cs" /> <Compile Include="ChromeProcessFactory.cs" />
<Compile Include="ChromeProcess.cs" /> <Compile Include="LocalChromeProcess.cs" />
<Compile Include="ChromeSession.cs" /> <Compile Include="ChromeSession.cs" />
<Compile Include="ChromeSessionExtensions.cs" /> <Compile Include="ChromeSessionExtensions.cs" />
<Compile Include="ChromeSessionFactory.cs" /> <Compile Include="ChromeSessionFactory.cs" />
<Compile Include="ChromeSessionInfo.cs" />
<Compile Include="Command.cs" /> <Compile Include="Command.cs" />
<Compile Include="CommandAttribute.cs" /> <Compile Include="CommandAttribute.cs" />
<Compile Include="Extensions\JTokenExtensions.cs" /> <Compile Include="Extensions\JTokenExtensions.cs" />
...@@ -90,6 +91,7 @@ ...@@ -90,6 +91,7 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ProtocolNameAttribute.cs" /> <Compile Include="ProtocolNameAttribute.cs" />
<Compile Include="Protocol\**\*.cs" /> <Compile Include="Protocol\**\*.cs" />
<Compile Include="RemoteChromeProcess.cs" />
<Compile Include="Serialization\MessageContractResolver.cs" /> <Compile Include="Serialization\MessageContractResolver.cs" />
<Compile Include="SupportedByAttribute.cs" /> <Compile Include="SupportedByAttribute.cs" />
</ItemGroup> </ItemGroup>
......
...@@ -15,5 +15,7 @@ namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Accessibility{ ...@@ -15,5 +15,7 @@ namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Accessibility{
Hidden, Hidden,
HiddenRoot, HiddenRoot,
Invalid, Invalid,
Keyshortcuts,
Roledescription,
} }
} }
...@@ -10,14 +10,18 @@ namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Accessibility ...@@ -10,14 +10,18 @@ namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Accessibility
[SupportedBy("Chrome")] [SupportedBy("Chrome")]
public class AXRelatedNode public class AXRelatedNode
{ {
/// <summary>
/// Gets or sets The BackendNodeId of the related DOM node.
/// </summary>
public long BackendDOMNodeId { get; set; }
/// <summary> /// <summary>
/// Gets or sets The IDRef value provided, if any. /// Gets or sets The IDRef value provided, if any.
/// </summary> /// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Idref { get; set; } public string Idref { get; set; }
/// <summary> /// <summary>
/// Gets or sets The BackendNodeId of the related node. /// Gets or sets The text alternative of this node in the current context.
/// </summary> /// </summary>
public long BackendNodeId { get; set; } public string Text { get; set; }
} }
} }
...@@ -12,9 +12,11 @@ namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Accessibility{ ...@@ -12,9 +12,11 @@ namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Accessibility{
public enum AXRelationshipAttributes public enum AXRelationshipAttributes
{ {
Activedescendant, Activedescendant,
Flowto,
Controls, Controls,
Describedby, Describedby,
Details,
Errormessage,
Flowto,
Labelledby, Labelledby,
Owns, Owns,
} }
......
using MasterDevs.ChromeDevTools;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Runtime.Serialization;
namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Accessibility{
/// <summary>
/// Enum of possible native property sources (as a subtype of a particular AXValueSourceType).
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum AXValueNativeSourceType
{
Figcaption,
Label,
Labelfor,
Labelwrapped,
Legend,
Tablecaption,
Title,
Other,
}
}
using MasterDevs.ChromeDevTools;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Accessibility
{
/// <summary>
/// A single source for a computed AX property.
/// </summary>
[SupportedBy("Chrome")]
public class AXValueSource
{
/// <summary>
/// Gets or sets What type of source this is.
/// </summary>
public AXValueSourceType Type { get; set; }
/// <summary>
/// Gets or sets The value of this property source.
/// </summary>
public AXValue Value { get; set; }
/// <summary>
/// Gets or sets The name of the relevant attribute, if any.
/// </summary>
public string Attribute { get; set; }
/// <summary>
/// Gets or sets The value of the relevant attribute, if any.
/// </summary>
public AXValue AttributeValue { get; set; }
/// <summary>
/// Gets or sets Whether this source is superseded by a higher priority source.
/// </summary>
public bool Superseded { get; set; }
/// <summary>
/// Gets or sets The native markup source for this value, e.g. a <label> element.
/// </summary>
public AXValueNativeSourceType NativeSource { get; set; }
/// <summary>
/// Gets or sets The value, such as a node or node list, of the native source.
/// </summary>
public AXValue NativeSourceValue { get; set; }
/// <summary>
/// Gets or sets Whether the value for this property is invalid.
/// </summary>
public bool Invalid { get; set; }
/// <summary>
/// Gets or sets Reason for the value being invalid, if it is.
/// </summary>
public string InvalidReason { get; set; }
}
}
...@@ -9,10 +9,13 @@ namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Accessibility{ ...@@ -9,10 +9,13 @@ namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Accessibility{
/// Enum of possible property sources. /// Enum of possible property sources.
/// </summary> /// </summary>
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public enum AXPropertySourceType public enum AXValueSourceType
{ {
Attribute, Attribute,
Implicit, Implicit,
Style, Style,
Contents,
Placeholder,
RelatedElement,
} }
} }
...@@ -17,12 +17,16 @@ namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Accessibility{ ...@@ -17,12 +17,16 @@ namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Accessibility{
Idref, Idref,
IdrefList, IdrefList,
Integer, Integer,
Node,
NodeList,
Number, Number,
String, String,
ComputedString,
Token, Token,
TokenList, TokenList,
DomRelation, DomRelation,
Role, Role,
InternalRole, InternalRole,
ValueUndefined,
} }
} }
...@@ -13,6 +13,7 @@ namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Accessibility{ ...@@ -13,6 +13,7 @@ namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Accessibility{
{ {
Checked, Checked,
Expanded, Expanded,
Modal,
Pressed, Pressed,
Selected, Selected,
} }
......
using MasterDevs.ChromeDevTools;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Accessibility
{
/// <summary>
/// Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists.
/// </summary>
[Command(ProtocolName.Accessibility.GetPartialAXTree)]
[SupportedBy("Chrome")]
public class GetPartialAXTreeCommand
{
/// <summary>
/// Gets or sets ID of node to get the partial accessibility tree for.
/// </summary>
public long NodeId { get; set; }
/// <summary>
/// Gets or sets Whether to fetch this nodes ancestors, siblings and children. Defaults to true.
/// </summary>
public bool FetchRelatives { get; set; }
}
}
using MasterDevs.ChromeDevTools;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Accessibility
{
/// <summary>
/// Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists.
/// </summary>
[CommandResponse(ProtocolName.Accessibility.GetPartialAXTree)]
[SupportedBy("Chrome")]
public class GetPartialAXTreeCommandResponse
{
/// <summary>
/// Gets or sets The <code>Accessibility.AXNode</code> for this DOM node, if it exists, plus its ancestors, siblings and children, if requested.
/// </summary>
public AXNode[] Nodes { get; set; }
}
}
...@@ -5,42 +5,50 @@ using System.Collections.Generic; ...@@ -5,42 +5,50 @@ using System.Collections.Generic;
namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Animation namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Animation
{ {
/// <summary> /// <summary>
/// AnimationPlayer instance. /// Animation instance.
/// </summary> /// </summary>
[SupportedBy("Chrome")] [SupportedBy("Chrome")]
public class AnimationPlayer public class Animation
{ {
/// <summary> /// <summary>
/// Gets or sets <code>AnimationPlayer</code>'s id. /// Gets or sets <code>Animation</code>'s id.
/// </summary> /// </summary>
public string Id { get; set; } public string Id { get; set; }
/// <summary> /// <summary>
/// Gets or sets <code>AnimationPlayer</code>'s internal paused state. /// Gets or sets <code>Animation</code>'s name.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Gets or sets <code>Animation</code>'s internal paused state.
/// </summary> /// </summary>
public bool PausedState { get; set; } public bool PausedState { get; set; }
/// <summary> /// <summary>
/// Gets or sets <code>AnimationPlayer</code>'s play state. /// Gets or sets <code>Animation</code>'s play state.
/// </summary> /// </summary>
public string PlayState { get; set; } public string PlayState { get; set; }
/// <summary> /// <summary>
/// Gets or sets <code>AnimationPlayer</code>'s playback rate. /// Gets or sets <code>Animation</code>'s playback rate.
/// </summary> /// </summary>
public double PlaybackRate { get; set; } public double PlaybackRate { get; set; }
/// <summary> /// <summary>
/// Gets or sets <code>AnimationPlayer</code>'s start time. /// Gets or sets <code>Animation</code>'s start time.
/// </summary> /// </summary>
public double StartTime { get; set; } public double StartTime { get; set; }
/// <summary> /// <summary>
/// Gets or sets <code>AnimationPlayer</code>'s current time. /// Gets or sets <code>Animation</code>'s current time.
/// </summary> /// </summary>
public double CurrentTime { get; set; } public double CurrentTime { get; set; }
/// <summary> /// <summary>
/// Gets or sets <code>AnimationPlayer</code>'s source animation node. /// Gets or sets <code>Animation</code>'s source animation node.
/// </summary> /// </summary>
public AnimationNode Source { get; set; } public AnimationEffect Source { get; set; }
/// <summary> /// <summary>
/// Gets or sets Animation type of <code>AnimationPlayer</code>. /// Gets or sets Animation type of <code>Animation</code>.
/// </summary> /// </summary>
public string Type { get; set; } public string Type { get; set; }
/// <summary>
/// Gets or sets A unique ID for <code>Animation</code> representing the sources that triggered this CSS animation/transition.
/// </summary>
public string CssId { get; set; }
} }
} }
using MasterDevs.ChromeDevTools;
namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Animation
{
/// <summary>
/// Event for when an animation has been cancelled.
/// </summary>
[Event(ProtocolName.Animation.AnimationCanceled)]
[SupportedBy("Chrome")]
public class AnimationCanceledEvent
{
/// <summary>
/// Gets or sets Id of the animation that was cancelled.
/// </summary>
public string Id { get; set; }
}
}
using MasterDevs.ChromeDevTools;
namespace MasterDevs.ChromeDevTools.Protocol.Chrome.Animation
{
/// <summary>
/// Event for each animation that has been created.
/// </summary>
[Event(ProtocolName.Animation.AnimationCreated)]
[SupportedBy("Chrome")]
public class AnimationCreatedEvent
{
/// <summary>
/// Gets or sets Id of the animation that was created.
/// </summary>
public string Id { get; set; }
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment