-
Notifications
You must be signed in to change notification settings - Fork 575
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
Enhanced chromeoptions arguments and preferences #883
Conversation
… multiple browsers with Selenide 5.x
private ChromeOptions transferChromeOptionsFromSystemProperties(Config config, ChromeOptions currentChromeOptions) { | ||
if (!config.chromeoptionsArgs().equals("")) { | ||
// Regexp from https://stackoverflow.com/a/15739087/1110503 to handle commas in values | ||
Stream<String> params = Arrays.stream(config.chromeoptionsArgs().split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)")); |
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.
really magic regexp
Agree) that's why I linked Stackoverflow answer with some explanations
Viele Grüße
Alexei Vinogradov
…On 10. December 2018 at 16:31:39, Dmitry Romashov ***@***.***) wrote:
***@***.**** commented on this pull request.
------------------------------
In src/main/java/com/codeborne/selenide/webdriver/ChromeDriverFactory.java
<#883 (comment)>:
> - Map<String, Object> prefs = parsePreferencesFromString(value);
- currentChromeOptions.setExperimentalOption("prefs", prefs);
- break;
- }
- default:
- log.warning(capability + " is ignored." +
- "Only so-called arguments (chromeoptions.args=<values comma separated>) " +
- "and preferences (chromeoptions.prefs=<comma-separated dictionary of key=value> " +
- "are supported for the chromeoptions at the moment");
- break;
- }
- }
+ private ChromeOptions transferChromeOptionsFromSystemProperties(Config config, ChromeOptions currentChromeOptions) {
+ if (!config.chromeoptionsArgs().equals("")) {
+ // Regexp from https://stackoverflow.com/a/15739087/1110503 to handle commas in values
+ Stream<String> params = Arrays.stream(config.chromeoptionsArgs().split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)"));
really magic regexp
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#883 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGQ4YBMIwUQzjFA1iK74-VbQHfu0iYA0ks5u3n5bgaJpZM4ZKXFY>
.
|
@vinogradoff Please resolve conflicts also |
@vinogradoff, That's reason of my proposal (#836) |
@rosolko resolved |
@@ -14,6 +14,8 @@ | |||
String browserBinary(); | |||
String pageLoadStrategy(); | |||
DesiredCapabilities browserCapabilities(); | |||
String chromeoptionsArgs(); | |||
String chromeoptionsPrefs(); |
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 don't like adding the settings. We have too lot of them. And these are chrome-specific settings in the global Config
class...
If somebody wants to tune Chrome settings so much, he can just implement WebDriverProvider
, right?
* Example: 123,"foo bar","bar,foo" | ||
* @return values as array, quotes are preserved | ||
*/ | ||
private String[] parseCSVhandlingQuotes(String csvString) { |
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.
Not a CSV source, reverts better prefs
name
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.
csv is actually a common abbr for "comma-separated values" - params are csv
Proposed changes
Chromeoptions arguments and preferences now allow to have commas in value, when parameter is masked with double quotes. see #836
Also they are made available as Configuration to work smoothly with Selenide 5.+ versions, with multiple browser.
Usage is documented in javadoc and tests.
Checklist
gradle check chrome htmlunit
command