-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update tooling and protocols #19
Conversation
svatal
commented
Aug 12, 2017
- merged abandoned georgiosd's PR Update tooling and protocols #15
- some other updates (protocols from Chrome 60, headless mode, example takes screenshot of the page, SendAsync returns correct response)
… of having to instantiate it
protocol conflicts resolved using master - regeneration needed
.. so user does not have to use cast on every command result that returns something interesting
var chromeProcessArgs = remoteDebuggingArg + " " + userDirectoryArg + " --bwsi --no-first-run"; | ||
var remoteDebuggingArg = $"--remote-debugging-port={port}"; | ||
var userDirectoryArg = $"--user-data-dir=\"{directoryInfo.FullName}\""; | ||
const string headlessArg = "--headless --disable-gpu"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we forcing headless here? I'm not comfortable doing this, unless others feel strongly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add an option.
public interface IChromeSession | ||
{ | ||
Task<ICommandResponse> SendAsync<T>(T parameter, CancellationToken cancellationToken); | ||
Task<CommandResponse<TResponse>> SendAsync<TResponse>(ICommand<TResponse> parameter, CancellationToken cancellationToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct? There was a reason it was just returning the interface. I'm having a hard time recalling the reason though. @qmfrederik do you have thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, now I see there is second implementation of ICommandResponse - ErrorResponse. And it can be returned from the task ..
I'd personally prefer setting task to faulty in such cases than to be forced to check and retype every command. What are your thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran through the history via git blame but I don't think I changed this to return an interface, it looks like it just always has been like that. (I did submit a bunch of other PRs to return interfaces in other areas, but not here).
I think this change is OK, since CommandResponse<T>
is a very simple class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, i really like this change, i'm just afraid of "breaking" other people using this.
await chromeSession.SendAsync(new SetVisibleSizeCommand {Width = ViewPortWidth, Height = height}); | ||
|
||
Console.WriteLine("Taking screenshot"); | ||
var screenshot = await chromeSession.SendAsync(new CaptureScreenshotCommand {Format = "png"}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do like this change ... it does seem like more advanced example. Would you be opposed to making a Simple and Advanced sample? Then we can link them from the README.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean keeping the original sample too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah ... maybe we can even make it simpler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something for later though
@svatal Do you think it would be possible to split off the protocol update in a separate PR? That would make the PR easier to review 😄 . |
@qmfrederik Hmm, I do not see a easy way how to do it - both code and protocol changes depends on each other. I had to fix protocol generator after updating protocol and on the same time the newly generated code is needed to return correct result from SendAsync |
@brewdente Cool to see this got merged. Any chance we get an updated NuGet package, too? 😄 |
@brewdente Really happy to see the changes merged, but what about the ErrorResponse? |
should be solved in PR #23 |
@qmfrederik heh ... i was doing it anyways. but i'm glad you were a fan of it too. I questioned the nuget version number ... ultimately went with 1.1.0 (which I think is right semantically). |