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
[java] WIP - proof of concept for using options with Selenium Manager #11376
Conversation
Codecov ReportBase: 52.83% // Head: 52.83% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## trunk #11376 +/- ##
=======================================
Coverage 52.83% 52.83%
=======================================
Files 82 82
Lines 5551 5551
Branches 198 198
=======================================
Hits 2933 2933
Misses 2420 2420
Partials 198 198 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
(This is to address #11372) |
I am OK when the PR template is ignored, but I think we should always provide the context of a PR (unless the code is extremely explicit). I understand why this PR was created and how the context was build through Slack discussions, but leaving this PR without a context will make future maintainers life very hard. This is why we have so much code in Java today that is doing magical stuff and we do not understand why. As for the contents of the PR, they seem fine to me, but I do not recall all the details of the conversation. |
This isn't production-ready code, so I moved it to draft status and added context with the specific questions I'm interested in getting feedback on. Thanks. |
Some issues... I think we need to deprecate either Since this code won't work as I have it implemented:
|
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.
The coupling here is wrong: to integrate the SeleniumManager you shouldn't need to make changes to the DriverService.
Roles and responsibilities:
- SeleniumManager: finding the driver and browser
- DriverService: managing the lifetime of the driver and browser
The DriverService doesn't care how the driver and browser are found, just that it has them.
@@ -99,14 +100,14 @@ private static String runCommand(String... command) { | |||
process.getInputStream(), StandardCharsets.UTF_8)); | |||
} catch (InterruptedException e) { | |||
LOG.warning(String.format("Interrupted exception running command %s: %s", | |||
Arrays.toString(command), e.getMessage())); | |||
command, e.getMessage())); |
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.
This expansion won't be the same, so people won't be able to copy-and-paste it.
Except that is exactly what it is currently concerning itself with. If the location isn't passed in by the user (very rarely the case), it has logic for locating it. We're currently putting the constraint on the Manager to only be used if the existing process would otherwise error. We can:
@shs96c which of these are you suggesting ^^ |
Ok, I spent a lot more time inside the DriverService classes trying to figure out a better approach... We can definitely pull out the finding pieces for better separation of concerns. I implemented a I think the Service class has to get passed in the options instance ( User will need to have done one of these:
So, we throw a warning if That is probably a better approach, but it's a lot to put together... |
ok, I used my previous comment to rethink things and improve on where I was going with it. I'm pretty sure #11411 is the superior implementation, so I'm going to close this. |
Description
I think this is the best way to get needed information from Options class to Selenium Manager.
createServiceWithConfig
by default.withOptions()
method that stores protected static options instance on DriverServicegetBinary()
); though, I guess we *could implement this in all driver service classes and essentially avoid all subclasses for now.Questions:
getBinary()
in all options classes and avoid subclassing requirements? (fwiw, Firefox's current implementation might complicate using Selenium Manager; Chrome was much easier to show the idea)Motivation
Previously, I was thinking about the need to specifically wrap
--driver-version
, which is why I brought up #11360As of now, though, I think everything that we need to be supporting in Selenium Manager we can pull from the Options class, and this is the best way I came up with for doing that.