Skip to content
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

Merged
merged 9 commits into from
Dec 31, 2018

Conversation

vinogradoff
Copy link
Member

@vinogradoff vinogradoff commented Dec 9, 2018

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

  • Checkstyle and unit tests pass locally with my changes by running gradle check chrome htmlunit command
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@vinogradoff vinogradoff mentioned this pull request Dec 10, 2018
3 tasks
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(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)"));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really magic regexp

@vinogradoff
Copy link
Member Author

vinogradoff commented Dec 10, 2018 via email

@rosolko
Copy link
Collaborator

rosolko commented Dec 11, 2018

@vinogradoff Please resolve conflicts also

@framebassman
Copy link

@vinogradoff, That's reason of my proposal (#836)

@vinogradoff
Copy link
Member Author

@rosolko resolved

@@ -14,6 +14,8 @@
String browserBinary();
String pageLoadStrategy();
DesiredCapabilities browserCapabilities();
String chromeoptionsArgs();
String chromeoptionsPrefs();
Copy link
Member

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?

@vinogradoff
Copy link
Member Author

@asolntsev ?

* Example: 123,"foo bar","bar,foo"
* @return values as array, quotes are preserved
*/
private String[] parseCSVhandlingQuotes(String csvString) {
Copy link
Collaborator

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

Copy link
Member Author

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

@vinogradoff vinogradoff merged commit 841afb9 into master Dec 31, 2018
@rosolko rosolko deleted the quotesInChromeOptions branch December 31, 2018 13:40
@asolntsev asolntsev added this to the 5.1.1 milestone Jan 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants