chrome-dev-tools-runtime-master
所属分类:C#编程
开发工具:C#
文件大小:569KB
下载次数:0
上传日期:2020-07-17 15:25:28
上 传 者:
leeslove
说明: Chrome Devtools Protocol协议的C#封装
(Chrome Devtools Protocol C# encapsulation)
文件列表:
BaristaLabs.ChromeDevTools.Runtime.Tests (0, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime.Tests\BaristaLabs.ChromeDevTools.Runtime.Tests.csproj (633, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime.Tests\Chrome.cs (5945, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime.Tests\ChromeSessionInfo.cs (884, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime.Tests\RuntimeTestSetup.cs (590, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime.Tests\Tests (0, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime.Tests\Tests\ErrorHandlingUnitTests.cs (1716, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime.Tests\Tests\ParallelUnitTests.cs (3411, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime.Tests\Tests\ScreenshotUnitTests.cs (2135, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime (0, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Accessibility (0, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Accessibility\AXNode.cs (2812, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Accessibility\AXProperty.cs (595, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Accessibility\AXPropertyName.cs (2836, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Accessibility\AXRelatedNode.cs (966, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Accessibility\AXValue.cs (1255, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Accessibility\AXValueNativeSourceType.cs (875, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Accessibility\AXValueSource.cs (2734, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Accessibility\AXValueSourceType.cs (711, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Accessibility\AXValueType.cs (1360, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Accessibility\AccessibilityAdapter.cs (1375, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Accessibility\GetPartialAXTreeCommand.cs (2196, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Animation (0, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Animation\Animation.cs (2417, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Animation\AnimationAdapter.cs (7195, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Animation\AnimationCanceledEvent.cs (452, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Animation\AnimationCreatedEvent.cs (449, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Animation\AnimationEffect.cs (2437, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Animation\AnimationStartedEvent.cs (451, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Animation\DisableCommand.cs (562, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Animation\EnableCommand.cs (557, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Animation\GetCurrentTimeCommand.cs (985, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Animation\GetPlaybackRateCommand.cs (824, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Animation\KeyframeStyle.cs (601, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Animation\KeyframesRule.cs (664, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Animation\ReleaseAnimationsCommand.cs (833, 2018-11-10)
BaristaLabs.ChromeDevTools.Runtime\Animation\ResolveAnimationCommand.cs (1022, 2018-11-10)
... ...
# chrome-dev-tools-runtime
Runtime for the [Chrome Developer Protocol](https://developer.chrome.com/devtools/docs/debugger-protocol). Generated by [BaristaLabs\chrome-dev-tools-generator](https://github.com/BaristaLabs/chrome-dev-tools-generator)
Similar to [Puppeteer](https://github.com/GoogleChrome/puppeteer) but more low-level and for .Net Core.
> Updated for Chrome 70!!
### Instructions
You can obtain the runtime from NuGet at the following location:
https://www.nuget.org/packages/BaristaLabs.ChromeDevTools.Runtime/
To execute the sample cli:
- Clone
- Launch Chrome with debugging enabled at port 9223
- Run
Windows:
``` bash
$ git clone https://github.com/BaristaLabs/chrome-dev-tools-runtime
$ cd chrome-dev-tools-runtime\ChromeDevToolsRuntimeCLI
$ "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9223
$ dotnet restore
$ dotnet run
```
macOS:
On macOS the behavior is a little different when launching the chrome process.
First, open a new terminal window and execute
``` bash
$ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9223 --user-data-dir=remote-profile
```
Then clone and run the sample CLI in another terminal window:
``` bash
$ git clone https://github.com/BaristaLabs/chrome-dev-tools-runtime
$ cd chrome-dev-tools-Runtime/ChromeDevToolsRuntimeCLI/
$ dotnet restore
$ dotnet run
```
### Commands
In general, using an instance of a ChromeSession, submit strongly-typed commands via the adapter methods.
``` CS
using (var session = new ChromeSession("ws://...")
{
await session.Page.Navigate(new Page.NavigateCommand
{
Url = "http://www.winamp.com"
});
}
```
All commands can specify a timeout and are cancellable:
``` CS
using (var session = new ChromeSession("ws://...")
{
var shouldCancel = new CancellationTokenSource();
await session.Page.Navigate(new Page.NavigateCommand
{
Url = "http://www.winamp.com"
}, millisecondsTimeout: 60000, cancellationToken: shouldCancel);
shouldCancel.Cancel();
}
```
### Events
Subscribe to events via the Subscribe method
``` CS
using (var session = new ChromeSession("ws://...")
{
session.Page.SubscribeToFrameNavigatedEvent((e) =>
{
Console.WriteLine($"Navigated to {e.Frame.Url}");
});
}
```
note that you may need to send the associated enable command for a particular domain.
As events are asynchronous, you may need to ensure you program is still running when the event occurs or you may miss it.
### Sample Projects
- [Skinny Html2Pdf](https://github.com/baristalabs/skinny-html2pdf) - Convert Pages to PDF within a container.
- [Skrapr](https://github.com/BaristaLabs/skrapr) - Declarative Web Scraping.
近期下载者:
相关文件:
收藏者: