-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from svatal/master
Update tooling and protocols
- Loading branch information
Showing
953 changed files
with
10,164 additions
and
6,660 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,42 @@ | ||
using System.Diagnostics; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.IO; | ||
|
||
namespace MasterDevs.ChromeDevTools | ||
{ | ||
public class ChromeProcessFactory : IChromeProcessFactory | ||
{ | ||
public IChromeProcess Create(int port) | ||
public IDirectoryCleaner DirectoryCleaner { get; set; } | ||
public string ChromePath { get; } | ||
|
||
public ChromeProcessFactory(IDirectoryCleaner directoryCleaner, string chromePath = @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe") | ||
{ | ||
DirectoryCleaner = directoryCleaner; | ||
ChromePath = chromePath; | ||
} | ||
|
||
public IChromeProcess Create(int port, bool headless) | ||
{ | ||
string path = Path.GetRandomFileName(); | ||
var directoryInfo = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), path)); | ||
var remoteDebuggingArg = "--remote-debugging-port=" + port; | ||
var userDirectoryArg = "--user-data-dir=\"" + directoryInfo.FullName + "\""; | ||
var chromeProcessArgs = remoteDebuggingArg + " " + userDirectoryArg + " --bwsi --no-first-run"; | ||
var processStartInfo = new ProcessStartInfo(@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", chromeProcessArgs); | ||
var chromeProcess = Process.Start(processStartInfo); | ||
return new ChromeProcess | ||
var remoteDebuggingArg = $"--remote-debugging-port={port}"; | ||
var userDirectoryArg = $"--user-data-dir=\"{directoryInfo.FullName}\""; | ||
const string headlessArg = "--headless --disable-gpu"; | ||
var chromeProcessArgs = new List<string> | ||
{ | ||
Process = chromeProcess, | ||
UserDirectory = directoryInfo, | ||
RemoteDebuggingUri = "http://localhost:" + port | ||
remoteDebuggingArg, | ||
userDirectoryArg, | ||
"--bwsi", | ||
"--no-first-run" | ||
}; | ||
if (headless) | ||
chromeProcessArgs.Add(headlessArg); | ||
var processStartInfo = new ProcessStartInfo(ChromePath, string.Join(" ", chromeProcessArgs)); | ||
var chromeProcess = Process.Start(processStartInfo); | ||
|
||
string remoteDebuggingUrl = "http://localhost:" + port; | ||
return new LocalChromeProcess(new Uri(remoteDebuggingUrl), () => DirectoryCleaner.Delete(directoryInfo), chromeProcess); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
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; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
|
||
namespace MasterDevs.ChromeDevTools | ||
{ | ||
public interface IChromeProcess : IDisposable | ||
{ | ||
Task<string[]> GetSessions(); | ||
Task<ChromeSessionInfo[]> GetSessionInfo(); | ||
|
||
DirectoryInfo UserDirectory { get; } | ||
Task<ChromeSessionInfo> StartNewSession(); | ||
|
||
Process Process { get; } | ||
|
||
string RemoteDebuggingUri { get; } | ||
Uri RemoteDebuggingUri { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System.IO; | ||
|
||
namespace MasterDevs.ChromeDevTools | ||
{ | ||
public interface IDirectoryCleaner | ||
{ | ||
void Delete(DirectoryInfo dir); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Diagnostics; | ||
|
||
namespace MasterDevs.ChromeDevTools | ||
{ | ||
public class LocalChromeProcess : RemoteChromeProcess | ||
{ | ||
public LocalChromeProcess(Uri remoteDebuggingUri, Action disposeUserDirectory, Process process) | ||
: base(remoteDebuggingUri) | ||
{ | ||
DisposeUserDirectory = disposeUserDirectory; | ||
Process = process; | ||
} | ||
|
||
public Action DisposeUserDirectory { get; set; } | ||
public Process Process { get; set; } | ||
|
||
public override void Dispose() | ||
{ | ||
base.Dispose(); | ||
|
||
Process.Kill(); | ||
Process.WaitForExit(); | ||
// Process.Close(); | ||
DisposeUserDirectory(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,7 @@ public enum AXGlobalStates | |
Hidden, | ||
HiddenRoot, | ||
Invalid, | ||
Keyshortcuts, | ||
Roledescription, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 0 additions & 40 deletions
40
source/ChromeDevTools/Protocol/Chrome/Accessibility/AXPropertySource.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.