Code Monkey home page Code Monkey logo

chrome-dev-tools-generator's People

Contributors

bartizan avatar jessetrinity avatar oceanswave avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chrome-dev-tools-generator's Issues

NuGet

Do you have plans to put this library on NuGet? Thanks.

Page finished loading event

Do you have an example of how to subscribe to the page load event? The example below never fires.

session.Page.SubscribeToLoadEventFiredEvent((e) =>
{
	Console.WriteLine("Finished loading...");
});

I'm trying to navigate and capture a screenshot of a page. It works if I call Sleep(1000) and then capture, which leads me to believe that the issue is that I'm trying to capture the screenshot before the page fully loads.

Here's the full (non-working) example:

using (var session = new ChromeSession("ws://localhost:9222/devtools/page/" + targetId))
{
	var navigateResult = session.Page.Navigate(new Page.NavigateCommand
	{
		Url = "https://www.google.com"
	}).GetAwaiter().GetResult();

        // This does not work...
	session.Page.SubscribeToLoadEventFiredEvent((e) =>
	{
		Console.WriteLine("Finished loading...");
	});

	//System.Threading.Thread.Sleep(1000);

	Console.WriteLine("Taking a screenshot!");

	var screenshotResponse = session.Page.CaptureScreenshot(new Page.CaptureScreenshotCommand
	{

	}).GetAwaiter().GetResult();

	File.WriteAllBytes("ss\\" + Guid.NewGuid().ToString("N") + ".png", Convert.FromBase64String(screenshotResponse.Data));

	Console.WriteLine("Done.");
	Console.ReadKey();
}

Thanks

Crash when generating with latest installed Chrome (109.0.5414.75)

Chrome: 109.0.5414.75
chrome-dev-tools-generator: abdf32b

GetProtocolDefinitionData crashes in new PdlConverter(pdlScript); when executing the script: Engine.Execute(script, Scope);.

System.TypeInitializationException
  HResult=0x80131534
  Message=The type initializer for 'CodecsInfo' threw an exception.
  Source=IronPython
  StackTrace:
   at IronPython.Runtime.Operations.StringOps.TryGetEncoding(String name, Encoding& encoding)
   at IronPython.Compiler.Tokenizer.TryGetEncoding(Encoding defaultEncoding, String line, Encoding& enc, String& encName)
   at IronPython.Runtime.PythonContext.GetSourceReader(Stream stream, Encoding defaultEncoding, String path)
   at Microsoft.Scripting.Runtime.LanguageBoundTextContentProvider.GetReader()
   at IronPython.Compiler.Parser.CreateParserWorker(CompilerContext context, PythonOptions options, Boolean verbatim)
   at IronPython.Runtime.PythonContext.ParseAndBindAst(CompilerContext context)
   at IronPython.Runtime.PythonContext.CompilePythonCode(SourceUnit sourceUnit, CompilerOptions options, ErrorSink errorSink)
   at IronPython.Runtime.PythonContext.CompileModule(String fileName, String moduleName, SourceUnit sourceCode, ModuleOptions options, ScriptCode& scriptCode)
   at IronPython.Runtime.Importer.LoadModuleFromSource(CodeContext context, String name, String path)
   at IronPython.Runtime.Importer.LoadFromDisk(CodeContext context, String name, String fullName, String str)
   at IronPython.Runtime.Importer.ImportFromPathHook(CodeContext context, String name, String fullName, List path, Func`5 defaultLoader)
   at IronPython.Runtime.Importer.ImportFromPath(CodeContext context, String name, String fullName, List path)
   at IronPython.Runtime.Importer.ImportTopAbsolute(CodeContext context, String name)
   at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object globals, String modName, Boolean bottom, Int32 level)
   at IronPython.Modules.Builtin.__import__(CodeContext context, String name, Object globals, Object locals, Object fromlist, Int32 level)
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`7.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run7[T0,T1,T2,T3,T4,T5,T6,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
   at IronPython.Runtime.Importer.ImportLightThrow(CodeContext context, String fullName, PythonTuple from, Int32 level)
   at IronPython.Runtime.Operations.PythonOps.ImportBottom(CodeContext context, String fullName, Int32 level)
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](T0 arg0)
   at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
   at IronPython.Runtime.PythonContext.InitializeModule(String fileName, ModuleContext moduleContext, ScriptCode scriptCode, ModuleOptions options)
   at IronPython.Runtime.Importer.LoadModuleFromSource(CodeContext context, String name, String path)
   at IronPython.Runtime.Importer.LoadFromDisk(CodeContext context, String name, String fullName, String str)
   at IronPython.Runtime.Importer.ImportFromPathHook(CodeContext context, String name, String fullName, List path, Func`5 defaultLoader)
   at IronPython.Runtime.Importer.ImportFromPath(CodeContext context, String name, String fullName, List path)
   at IronPython.Runtime.Importer.ImportTopAbsolute(CodeContext context, String name)
   at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object globals, String modName, Boolean bottom, Int32 level)
   at IronPython.Modules.Builtin.__import__(CodeContext context, String name, Object globals, Object locals, Object fromlist, Int32 level)
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`7.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run7[T0,T1,T2,T3,T4,T5,T6,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
   at IronPython.Runtime.Importer.ImportLightThrow(CodeContext context, String fullName, PythonTuple from, Int32 level)
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
   at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
   at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3[T0,T1,T2](CallSite site, T0 arg0, T1 arg1, T2 arg2)
   at ChromeDevToolsGeneratorCLI.PdlConverter..ctor(String script) in C:\Users\me\Code\chrome-dev-tools\src\ChromeDevToolsGeneratorCLI\PdlConverter.cs:line 31
   at ChromeDevToolsGeneratorCLI.Program.<GetProtocolDefinitionData>d__1.MoveNext() in C:\Users\me\Code\chrome-dev-tools\src\ChromeDevToolsGeneratorCLI\Program.cs:line 113
   at ChromeDevToolsGeneratorCLI.Program.Main(String[] args) in C:\Users\me\Code\chrome-dev-tools\src\ChromeDevToolsGeneratorCLI\Program.cs:line 37

  This exception was originally thrown at this call stack:
    System.Text.Encoding.GetDataItem()
    System.Text.Encoding.WindowsCodePage.get()
    IronPython.Runtime.Operations.StringOps.CodecsInfo.MakeCodecsDict()
    IronPython.Runtime.Operations.StringOps.CodecsInfo.CodecsInfo()

Inner Exception 1:
NotSupportedException: No data is available for encoding 932. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.

Unmapped data type: binary - Google Chrome 72/73

$ git clone https://github.com/BaristaLabs/chrome-dev-tools
$ cd chrome-dev-tools\src\ChromeDevToolsGeneratorCLI
$ dotnet run ChromeDevToolsGeneratorCLI -o "C:\temp\ChromeDevToolsRuntime"

does not seem to work with Chrome 72 and 73, it returns:

dotnet run ChromeDevToolsGeneratorCLI -o "C:\temp\ChromeDevToolsRuntime"
Loading protocol definition...
Using previously obtained protocol definition...
Validating protocol definition...
Generating protocol definition from current generator interface...
Generating protocol definition code files...

Unhandled Exception: System.InvalidOperationException: Unmapped data type: binary
at BaristaLabs.ChromeDevTools.RemoteInterface.CodeGen.Utility.GetTypeMappingForType(TypeDefinition typeDefinition, DomainDefinition domainDefinition, IDictionary2 knownTypes, Boolean isArray) in chrome-dev-tools\src\BaristaLabs.ChromeDevTools.RemoteInterface\CodeGen\Utility.cs:line 105 at BaristaLabs.ChromeDevTools.RemoteInterface.CodeGen.TemplatesManager.<>c.<GetGeneratorForTemplate>b__5_2(TextWriter writer, Object context, Object[] arguments) in chrome-dev-tools\src\BaristaLabs.ChromeDevTools.RemoteInterface\CodeGen\TemplatesManager.cs:line 126 at lambda_method(Closure , TextWriter , Object ) at HandlebarsDotNet.Compiler.IteratorBinder.Iterate(IteratorBindingContext context, IEnumerable sequence, Action2 template, Action2 ifEmpty) at lambda_method(Closure , TextWriter , Object ) at HandlebarsDotNet.Handlebars.HandlebarsEnvironment.<>c__DisplayClass7_0.<Compile>b__0(Object context) at BaristaLabs.ChromeDevTools.RemoteInterface.CodeGen.CommandGenerator.GenerateCode(CommandDefinition commandDefinition, CodeGeneratorContext context) in chrome-dev-tools\src\BaristaLabs.ChromeDevTools.RemoteInterface\CodeGen\CommandGenerator.cs:line 28 at BaristaLabs.ChromeDevTools.RemoteInterface.CodeGen.DomainGenerator.GenerateCode(DomainDefinition domainDefinition, CodeGeneratorContext context) in blab\chrome-dev-tools\src\BaristaLabs.ChromeDevTools.RemoteInterface\CodeGen\DomainGenerator.cs:line 43 at BaristaLabs.ChromeDevTools.RemoteInterface.CodeGen.ProtocolGenerator.GenerateCode(ICollection1 domains, Dictionary`2 knownTypes) in chrome-dev-tools\src\BaristaLabs.ChromeDevTools.RemoteInterface\CodeGen\ProtocolGenerator.cs:line 208
at BaristaLabs.ChromeDevTools.RemoteInterface.CodeGen.ProtocolGenerator.GenerateCode(ProtocolDefinition protocolDefinition, CodeGeneratorContext context) in chrome-dev-tools\src\BaristaLabs.ChromeDevTools.RemoteInterface\CodeGen\ProtocolGenerator.cs:line 92
at ChromeDevToolsGeneratorCLI.Program.Main(String[] args) in chrome-dev-tools\src\ChromeDevToolsGeneratorCLI\Program.cs:line 51

Error 404 with GetBrowserProtocolForChromeVersion and etc.

Let's look at GetBrowserProtocolForChromeVersion:
https://github.com/BaristaLabs/chrome-dev-tools-generator/blob/master/src/BaristaLabs.ChromeDevTools.Core/Chrome.cs#L148
It uses following URL:
$"https://chromium.googlesource.com/chromium/src/+/{chromeVersion.WebKitVersionHash}/third_party/blink/renderer/core/inspector/browser_protocol.pdl?format=TEXT"
I have Chrome 66.0.3359.139.
{chromeVersion.WebKitVersionHash} is a020eddf0d85fe84d4a6787b304f50aafb670969 in this case.
It is really exist such tree:
https://chromium.googlesource.com/chromium/src/+/a020eddf0d85fe84d4a6787b304f50aafb670969/
Also it has "/thirdparty", "/thirdparty/blink"... but hasn't "/thirdparty/blink/renderer" and next folders.

Conclusion: not each googlesource tree has all required files. Some another way should be used.

Possible work-around:
Open root tree URL. Remember parent tree URL. If current tree hasn't such file - open parent tree URL. And so until file found. But I am hasn't tried it and it is obviously it could take many time.

P.S. I could contribute if you will merge :)

.NET 4.5 Support

Hi,
chrome-dev-tools-runtime library works great for us (debugging js), the only thing is that we are bound to .NET 4.5, so .NET Core is not an option for us at the moment. What is the best way to get this working on .NET Framework? Should the generator or the generated class library be changed? How difficult would it be in general?
Thank you.

Handlebars.RegisterHelper: System.ArgumentException: 'Cannot bind to the target method

I'm trying to run the generator and get the exception below.
O/S: Windows x64
VS 2017 15.3.1
HEAD (latest commit ea9f66a)

System.ArgumentException: 'Cannot bind to the target method because its signature or security transparency is not compatible with that of the delegate type.'

System.Private.CoreLib.ni.dll!System.Reflection.RuntimeMethodInfo.CreateDelegateInternal(System.Type delegateType, object firstArgument, System.DelegateBindingFlags bindingFlags, ref System.Threading.StackCrawlMark stackMark) Unknown Symbols loaded.
System.Private.CoreLib.ni.dll!System.Reflection.RuntimeMethodInfo.CreateDelegate(System.Type delegateType) Unknown Symbols loaded.
Handlebars.dll!HandlebarsDotNet.BuiltinHelpers.GetHelpers<HandlebarsDotNet.HandlebarsHelper>() Unknown No symbols loaded.
Handlebars.dll!HandlebarsDotNet.Handlebars.HandlebarsEnvironment.RegisterBuiltinHelpers() Unknown No symbols loaded.
Handlebars.dll!HandlebarsDotNet.Handlebars.HandlebarsEnvironment.HandlebarsEnvironment(HandlebarsDotNet.HandlebarsConfiguration configuration) Unknown No symbols loaded.
Handlebars.dll!HandlebarsDotNet.Handlebars..cctor.AnonymousMethod__13_0() Unknown No symbols loaded.
System.Private.CoreLib.ni.dll!System.Lazy<HandlebarsDotNet.IHandlebars>.CreateValue() Unknown Symbols loaded.
System.Private.CoreLib.ni.dll!System.Lazy<HandlebarsDotNet.IHandlebars>.LazyInitValue() Unknown Symbols loaded.
Handlebars.dll!HandlebarsDotNet.Handlebars.Instance.get() Unknown No symbols loaded.
Handlebars.dll!HandlebarsDotNet.Handlebars.RegisterHelper(string helperName, HandlebarsDotNet.HandlebarsHelper helperFunction) Unknown No symbols loaded.

BaristaLabs.ChromeDevTools.RemoteInterface.dll!BaristaLabs.ChromeDevTools.RemoteInterface.CodeGen.TemplatesManager.GetGeneratorForTemplate(BaristaLabs.ChromeDevTools.RemoteInterface.CodeGen.CodeGenerationTemplateSettings templateSettings) Line 51 C# Symbols loaded.
BaristaLabs.ChromeDevTools.RemoteInterface.dll!BaristaLabs.ChromeDevTools.RemoteInterface.CodeGen.ProtocolGenerator.GenerateCode(BaristaLabs.ChromeDevTools.RemoteInterface.ProtocolDefinition.ProtocolDefinition protocolDefinition, BaristaLabs.ChromeDevTools.RemoteInterface.CodeGen.CodeGeneratorContext context) Line 84 C# Symbols loaded.
RemoteInterfaceGeneratorCLI.dll!RemoteInterfaceGeneratorCLI.Program.Main(string[] args) Line 50 C# Symbols loaded.

Error in Response classes with optional parameters

for example
file: Runtime\EvaluateCommand.cs
class: EvaluateCommandResponse
[JsonProperty("exceptionDetails, DefaultValueHandling = DefaultValueHandling.Ignore")]

Wrong Quotes position.

Should be
[JsonProperty("exceptionDetails", DefaultValueHandling = DefaultValueHandling.Ignore)]

Need some explain

Hello:
I don't quite understand your README.md file.
You mentioned "protocol definition file", I think, maybe you mean this file:
https://github.com/ChromeDevTools/devtools-protocol/blob/master/json/browser_protocol.json
From this file, I can see the latest browser_protocol is version 1.3.
But the code from this url is not working any more:
cyrus-and/chrome-remote-interface#10 (comment)
If I understand correctly, you need browser_protocol.json and js_protocol.json two Json files.
Then you can simply use the following code to download them. I hope the URLs can stay that way longer. #18 `class Program
{
private const string browser_protocol =
@"https://raw.githubusercontent.com/ChromeDevTools/devtools-protocol/master/json/browser_protocol.json";
private const string js_protocol =
@"https://raw.githubusercontent.com/ChromeDevTools/devtools-protocol/master/json/js_protocol.json";
private const string protocol_folder =
@"C:\Temp\ProtocolFiles";

static void Main()
{
WebClient webClient = new WebClient();
webClient.DownloadFile(browser_protocol, protocol_folder + "browser_protocol.json");
webClient.DownloadFile(js_protocol, protocol_folder + "js_protocol.json");
}
}
`
Please advice if I am correct in understanding your code.
Thanks,

Input.dispatchMouseEvent: Unexpected event type

i want to use "Input.dispatchTouchEvent" function,but i do not know how to set "type" parameter.

the Chrome DevTools Protocol Viewer describe like this.

Input.dispatchMouseEvent #
Dispatches a mouse event to the page.
PARAMETERS
type
string
Type of the mouse event.

thanks a lot.

Ws_Error throw e.Exception and how to catch it

Ws_Error throw e.Exception and how to catch it in App

    #region EventHandlers
    private void Ws_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
    {
        LogError("Error: {exception}", e.Exception);
        throw e.Exception;
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.