Note: I am not asking about setting the path of the chromedriver.
I want to run a Selenium node with a specific version of Chromium as opposed to the default Chrome installed on the system. The webdriver doc says I would need to pass a ChromeOptions object, but this is obviosuly impossible to do on the command line.
I've tried manually adding a JSON that represents ChromeOptions to the command line (like below), but it does not have any effect.
java.exe -jar selenium-server-standalone-2.47.1.jar -role node -hub http://localhost:4444/grid/register -browser browserName="chrome",version=ANY,platform=WINDOWS,maxInstances=5,chromeOptions={binary:./chromium/chrome.exe} -Dwebdriver.chrome.driver=chromedriver.exe
(I've tried all different ways of quoting the JSON, but it is simply not used.)
What has not been made clear in the bug filed for this nor the documentation is that a new capability key "chrome_binary" has been added to specifically support this. See commit 41a9d29.
This key can be used in the -browser argument used to start a node and the node will build the ChromeOption for you.
Related
I am trying to modify Chromium browser's behavior in Chromium OS.
When I execute Chromium browser, I can handover arguments with '--enable-features=' flag.
And I found a argument (#enable-virtual-keyboard) from Available list in chrome://flags.
Then I executed Chromium browser like below.
example instruction # /opt/google/chrome/chrome --incognito --enable-features=enable-virtual-keyboard
And when I check the flags in chrome://version, I could see the arguments.
Command Line: /opt/google/chrome/chrome --blahblah --enable-features=enable-virtual-keyboard
But actually the virtual keyboard is not working.
When I enable the argument (virtual keyboard) from chrome://flags manually. It works well and I could see the Virtual Keyboard.
What is wrong? I would appreciate it if you guys advise me.
--enable-features actually takes the name of a feature, not the name of a flag. The Chromium documentation explains the difference, but to simplify somewhat, a flag is sort of a user-visible interface to a feature or a command-line switch.
Anyway, to do what you want, you need to find out what feature or command-line switch the enable-virtual-keyboard flag toggles. Searching for enable-virtual-keyboard in Chromium Code Search brings us to these lines in about_flags.cc:
{"enable-virtual-keyboard", flag_descriptions::kVirtualKeyboardName,
flag_descriptions::kVirtualKeyboardDescription, kOsCrOS,
SINGLE_VALUE_TYPE(keyboard::switches::kEnableVirtualKeyboard)},
That last line tells us what we're looking for: that this flag is actually backed by a command-line switch, not a feature. Clicking on kEnableVirtualKeyboard shows us its definition:
const char kEnableVirtualKeyboard[] = "enable-virtual-keyboard";
So, adding --enable-virtual-keyboard to your command line should have the same effect as flipping the flag. (I should note, though, that there are a number of things that can break the virtual keyboard, so you may have to do other things to get it working.)
For the sake of completeness, if you'd found that it was actually backed by a feature, like the gesture-properties-dbus-service flag, for example:
{"gesture-properties-dbus-service",
flag_descriptions::kEnableGesturePropertiesDBusServiceName,
flag_descriptions::kEnableGesturePropertiesDBusServiceDescription, kOsCrOS,
FEATURE_VALUE_TYPE(chromeos::features::kGesturePropertiesDBusService)},
Then clicking kGesturePropertiesDBusService takes us to its definition which specifies the feature name:
const base::Feature kGesturePropertiesDBusService{
"GesturePropertiesDBusService", base::FEATURE_DISABLED_BY_DEFAULT};
...so in that case you'd pass --enable-features=GesturePropertiesDBusService to enable the flag from your command line.
I did the __disable-web-security in Terminal on Mac. Do I need to enable it again? Or does it enable by itself after restart?
If I need to enable it again, how do I do that? I searched everywhere, but didn't find.
Go to chrome://version and look at the Command Line. If the command line argument is still there, you should restart chrome and then launch it normally (without the flag).
A bit more context: "Flag" refers to two slightly different concepts in Chrome:
Any command line argument that starts with a -- (as opposed to an argument that names a URL or a file, for example).
The list of toggles available at chrome://flags.
Any arguments added manually to the command line will only persist until you quit Chrome. On the other hand, the toggles set at chrome://flags will persist until they are reset. (To further blur this, invoking chrome://restart will preserve the command line flags.)
This particular flag makes its presence fairly obvious, with a banner:
You are using an unsupported command-line flag: --disable-web-security. Stability and security will suffer.
So it should hopefully be clear whether the flag is present (and also why this is the sort of flag that can't be persisted at chrome://flags).
The flags set in #2 are delimited in Chrome's command line by the --flags-switches-begin…--flags-switches-end section. Arguments outside of that section are coming from somewhere other than chrome://flags (namely, from the command line, except in the case of Chrome OS and Android, which have their own startup procedures).
I want to enable a flag (enable-token-binding) while launching chrome.
I can do that using chrome://flags page. but for running tests I need to do it from command line.
I tried
chrome --enable-features=token-binding
chrome --enable-token-binding
None of them worked.
go to chrome://version
Find the command line arguments:
Command Line /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --enable-audio-service-sandbox --flag-switches-begin --enable-features=CookiesWithoutSameSiteMustBeSecure,SameSiteByDefaultCookies --flag-switches-end --enable-audio-service-sandbox
Run the above command with all the arguments and your chrome instance would have all the settings preset.
Try --flag-switches-begin --enable-token-binding --flag-switches-end.
The patter is --flag-switches start and ends capping the flags. Then the names of the flags provided as the parameters within with -- prefixed to them.
Token Binding was removed in Chrome release 70
see https://www.chromestatus.com/feature/5097603234529280
mayankSinha's answer works for the flags he mentions. Note the changed naming convention though: "lower case split by -" convention gets changed to CamelCase.
i.e. same-site-by-default-cookies (as shown in chrome://flags) becomes SameSiteByDefaultCookies
By changing the management and public interface to the host name in standalone.xml , we can allow remote access to wildfly. Want to do this directly without touching the standalone xml file.
Using wildfly cli interactive mode, added the following and it works well.
/interface=localHostName/:add(inet-address= "${jboss.bind.address.management:<hostname of target box>}")
Now, i want to add the same in cli non-interactive mode using the --command/--commands option
Tried this, but getting stuck at the syntax thing,
./jboss-cli.sh --connect command="/interface=localHostName/:add(inet-address="${jboss.bind.address.management:<hostname of target box>}")"
Please let me know the correct syntax of adding an inet-address to wildfly through command option.
actually this should work:
./jboss-cli.sh -c --command="/interface=localHostName:add(inet-address=${jboss.bind.address.management:<hostname of target box>})"
but I also get an error with the variable replacement. I checked it with this command and it worked:
./jboss-cli.sh -c --command="/interface=localHostName:add(inet-address=<hostname of target box>)"
I also had a glance at the jboss-cli.xml configuration file but the resolve-parameter-values property was already set to false so I don't know why the CLI is trying to replace this property.
The question is if you really need this property. I think you won't since you are setting it to the same property as the management-interface. So passing this property at startup will change both interfaces' inet-address values. I'm also setting the address using a CLI script and also omit the property since this interface's inet-address binding won't be changed for productional setup.
Packaging a log4j configuration file in a NetBeans Platform application apparently requires some thinking through. This is what I tried...
I put log4j.xml in src/main/resources/my/package/log4j.xml of some_netbeans_module. The package is a public module package (i.e. classes from this package are used from other packages). I rebuilt the module and confirmed that the file does, in fact, get packaged into the module.
In my classes I get an instance of the logger the way I always do:
static final Logger log = Logger.getLogger(ThisClass.class);
Every NetBeans Platform application has a my_app.conf file which makes it possible to set certain properties. This is where I set log4j.conf:
log4j.configuration="/my/package/log4j.xml"
Now, when I run the application, I see the following output:
[INFO] /home/me/my_app/application/target/my_app/bin/../etc/my_app.conf: 5:
log4j.configuration=/my/package/log4j.xml: not found
What is wrong with the above configuration?
In the my_app.conf file if you append the log4j.configuration property to the default_options property, like so:
default_options="...<other options> -J-Dlog4j.configuration=my/package/log4j.xml"
then this option will get passed to the JVM. Notice that the log4j property has -J-D appended to it. The -J is used by NetBeans to delineate JVM properties and the -D is used by the JVM to delineate a system property.
Also you can/should drop the quotes and the initial / as the quotes are not necessary and NetBeans will complain if you have the initial /
The other way to do this, and the way that I prefer since it doesn't require editing the .conf file, is to put the log4j.xml file into the default package. If you have other requirements that prevents you from doing this then remember that you must put the log4j.configuration property in the app's platform.properties file while your in dev mode and running the app inside of the IDE. Like so:
run.args.extra=-J-Dlog4j.configuration=my/package/log4j.xml
Edit: For questions regarding NetBeans Platform you might have better luck posting to the NetBeans Platform Users forum.