Disable Chrome address bar autosearch for dev - google-chrome

Developing a web app locally and I just can't get Chrome to actually go to this address, because auto search always kicks in (http://0.0.0.0:5000/api works though, for example).
Is there a way to overwrite this behaviour or force Chrome to try a http request first, before anything else?
I am aware I can just curl it or whatever to see the response...

Go to chrome://omnibox/ and check [x] Prevent inline autocomplete
The answer to this has to be in chrome://chrome-urls
you should see something like the following:
The "full" set of settings is on the chrome://chrome-urls . Also chrome://flags is worth to check. As a side by enabling some experimental features from chrome://flags you can greatly enhance your browsers HTML5 support which can be checked at HTML 5 support .
else:
Clear browser historythen go to settings and under Privacy --> uncheck [] Use a prediction service to help complete searches and URLs typed in the address bar .
Another idea is to examine carefully if using linux the output of the following command for parameters:
ps -aux | grep google-chrome-stable
in my case the output tells me a lot about what parameters are used at launch by default:
/opt/google/chrome/chrome --type=renderer --disable-layer-squashing --enable-transition-compositing --enable-deferred-image-decoding --enable-display-list-2d-canvas --enable-distance-field-text --enable-encrypted-media --enable-experimental-canvas-features --enable-experimental-web-platform-features --enable-lcd-text --enable-one-copy --enable-overlay-scrollbar --enable-renderer-mojo-channel --enable-smooth-scrolling --enable-viewport-meta --enable-webgl-draft-extensions --enable-web-midi --enable-zero-copy --max-tiles-for-interest-area=512 --enable-plugin-power-saver --lang=en-US --force-fieldtrials=AutoReloadExperiment/FlagEnabled/AutoReloadVisibleOnlyExperiment/FlagEnabled/ChromeSuggestions/Default/DomRel-Enable/enable/EnhancedBookmarks/Default/ExtensionContentVerification/Enforce/ExtensionInstallVerification/None/GCM/Enabled/MaterialDesignNTP/Enabled_forced/OmniboxBundledExperimentV1/StandardR4/PasswordGeneration/Disabled/PrerenderFromOmnibox/OmniboxPrerenderEnabled/QUIC/FlagEnabled/SafeBrowsingIncidentReportingService/Default/SettingsEnforcement/no_enforcement/UMA-Dynamic-Binary-Uniformity-Trial/default/UMA-Population-Restrict/normal/UMA-Uniformity-Trial-1-Percent/group_09/UMA-Uniformity-Trial-10-Percent/group_02/UMA-Uniformity-Trial-100-Percent/group_01/UMA-Uniformity-Trial-20-Percent/group_04/UMA-Uniformity-Trial-5-Percent/group_16/UMA-Uniformity-Trial-50-Percent/group_01/UwSInterstitialStatus/OnButInvisible/VoiceTrigger/Install/WebRTC-IPv6Default/Default/ --enable-crash-reporter=9F2AFD26-85F1-40CB-991F-0980EF2C4D14 --enable-offline-auto-reload --enable-offline-auto-reload-visible-only --enable-offline-load-stale-cache --enable-app-window-controls --enable-embedded-extension-options --enable-experimental-extension-apis --enable-scripts-require-action --enable-nacl --enable-nacl-debug --enable-streamlined-hosted-apps --enable-web-based-signin --javascript-harmony --out-of-process-pdf --enable-delegated-renderer --enable-impl-side-painting --num-raster-threads=4 --enable-gpu-rasterization --channel=5035.27.2136067136
Even yet another idea is maybe to write a small widget using python's tkinter and the webrowser modules, it could even get its input from the clipboard.
this command could be a work around solution too:
python -m webbrowser -t "http://ip.ip.ip.ip:portport/file/"
Another option yet is to use The Omnibox API and embed a custom omnibox in a simple webpage. Here are the omnibox api ready made samples.

You can avoid this by adding a "/" at the end of the URL http://0.0.0.0:5000/api/
or
You can try to add a null search engine with a URL of http://%s and null keyword.
Go to the search engine settings:
Open Settings.
Click Manage search engines
At the bottom of the Other search engines section add a new search engine.

Using #Juan Buhagiar answer as a starting point, I added your URL as the URL of a default search engine:
Other search engines
| MyAPI | 0.0.0.0 | http://0.0.0.0:5000/api/venues/show/45/20/cafes?rubbish=%s |
That just worked. The only drawback is that you get a redundant query to your request:
http://0.0.0.0:5000/api/venues/show/45/20/cafes?rubbish=0.0.0.0%3A5000%2Fapi%2Fvenues%2Fshow%2F45%2F20%2Fcafes%2F
instead of plain:
http://0.0.0.0:5000/api/venues/show/45/20/cafes
So as long as it does not conflict with your own GET, you can just ignore it.

Simplest way - Add a bookmark with your desired address. This time it will not goto search. This may not be useful if you have to change variables regularly, which was not my case.
This is helpful if you do not want it to disable omnibar search completely since it is quite a useful feature.

Related

How to write argument for Chrome/Chromium's '--enable-features=' flag

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.

Unable to hide “Chrome is being controlled by automated software” infobar within Chrome v76

This is not really a new question, nor an answer to the original question, but is rather a request for clarrity since the answer posted to the original question is incomplete, but any request for clarrity gets deleted...
Original post is here... Unable to hide "Chrome is being controlled by automated software" infobar within Chrome v76
So, while I understand your original answer, we do not use managed instances of Chrome, and we all run on Windows 10 Home Edition... so, this setting your answer is not an option for us. On the other hand, all of our regression tests are failing now because this stupid banner is in the way of everything.
Is there a way a non-IT-Managed user running Windows 10 Home Edition can suppress this banner?
If not, how does Google expect us to continue using Chrome for testing? Any suggestions greatly appreciated... Also, I am using Python, so if you supply code example, please keep that in mind... this is what I am currently doing, and it was working before last week, but not working now...
options = webdriver.ChromeOptions()
options.add_argument('--start-maximized')
options.add_argument("--disable-infobars")
options.add_argument("--disable-extensions")
options.add_argument("--disable-automation")
options.add_argument("--log-level=3")
# options.add_argument('headless')
options.add_argument('window-size=1920x1012')
options.add_experimental_option("prefs", {"download.prompt_for_download": False})
options.add_experimental_option("prefs", {"plugins.plugins_list": [{"enabled": False, "name": "Chrome PDF Viewer"}]})
options.add_experimental_option("prefs", {"download.default_directory": os.path.abspath(context.BaseResultsDir + '/Downloads/')})
options.add_experimental_option("prefs", {"download.extensions_to_open": "applications/pdf"})
context.driver = webdriver.Chrome(chrome_options=options)
After much Googling, this is finally what worked for me... Updated Selenium, switched to Canary release of ChromeDriver, and then made these adjustments to my test code, which is Python...
# options.add_argument("--disable-infobars") <<< TOOK THIS OUT
# options.add_argument("--disable-automation") <<< TOOK THIS OUT
options.add_experimental_option("excludeSwitches", ["enable-automation"]) <<< PUT THIS IN (Finding this one was the real killer)
options.add_experimental_option("useAutomationExtension", False) <<< PUT THIS IN
Your solution and mine are very similar. Thank you for posting.
David
Probably reason behind settings for infobar was working still last week not in this week, are may be you have updated/autoupdated chromedriver or chromebrowser. However your setting to disable infobar are not working because as per this commit on - Jan 10 2018, --disable-infobars option has been removed from chrome options
Solutions - Keeping this line does nothing options.add_argument("--disable-infobars") you can remove it.
options.add_argument("--disable-automation")
This line makes real confusion here towards the solution because there are 2 different ways to do it (By default this switch is enabled we have to remove it to disable the infobar). This line disables the password saving UI for more details read this nice discussion
Use this line do disable the infobar by excluding enable automation switch -
options.add_experimental_option("excludeSwitches" , ["enable-automation"])
It solves the problem to some extent, when I tried with this intermittently developer code plugin popup comes up and ask to enable/disable it. and it wont go away by options.add_argument("--disable-extensions") this. If you facing same issue use another switch to disable it as below-
options.add_experimental_option("excludeSwitches" , ["enable-automation","load-extension"])
This solves the problem from root(load-extension switch supports Chromedriver v2.33 and later). However there is one more way to disable the developer code plugin popup which you can do by adding --disable-plugins into shortcut of chrome
If these solutions doesn't work for you then chromium command line switches here can help you to customize the chrome behavior
Additionaly ChromeDriver(Capabilities capabilities) is deprecated and can be used as
capabilities = DesiredCapabilities.CHROME.copy()
capabilities.update(options.to_capabilities())
driver = webdriver.Chrome(chromedriver, desired_capabilities=capabilities)
solution to disable infobar in Java
options.setExperimentalOption("excludeSwitches", Arrays.asList("enable-automation" , "load-extension"));
will disable infobar with developer code plugin
This worked for me:
options.add_option('excludeSwitches', ['enable-automation'])
Method add_experimental_option, I suppose, is removed from the latest versions.

Command to retrieve browser URL in sikuli script

I am working on a testing tool and am using Sikuli to emulate user requests to the web application.
Is there a way for me to retrieve the url in the browser address bar (after clicking on a specific link) ?
Any help, pointers into documentation would be greatly appreciated
Cheers!
There is no way to do this in Sikuli. I could recommend you use Selenium. It is the best framework for web testing.
I'd do this with keystrokes. Select all, copy-paste using the clipboard.
click("url.png" ) # select the url location; may be a bit iffy/browser dependent
type("a", KEY_CTRL) # select all
type("c", KEY_CTRL) # copy to clipboard
click("target.png" ) # go to your target
type("v", KEY_CTRL) # and paste
Reference:
http://doc.sikuli.org/keys.html
Simple solution
click(your link);sleep(2) # or wait for loading to finish via an exists()
type("l",Key.CTRL) # hotkey for address bar selection on FF and GC
type("c",Key.CTRL) #copies
You could use the command : type("c", key modifier.CTRL) and after the command: App.get Clipboard(). The commando App.getClipboard get the text of your clipboard and you could save this text one object or variable for use later. (Sorry my english kkk)

Stylish: "Turn all styles off" from command line?

I frequently end up doing ~5 different manual actions when switching between using my laptop in dark environments and light environments, one of which is clicking Turn all styles off in the Stylish extension toolbar button to disable my dark user styles. I'd like to automate this somehow, probably a script bound to a hotkey. Is there a way to have the same effect as clicking Turn all styles off through the command line or some other way to accomplish this goal? I'm using Stylish in Chrome on Ubuntu.
My findings are that there isn't any way to change chrome extension settings from the command line and that the best way to do this is to set a key binding per #wOxxOm's comment and to use xdotool to send the keystrokes to chrome. There are a lot of gotchas in getting this to work. This is the final command I ended up using:
xdotool search --class 'google-chrome' windowactivate --sync \
key --window 0 --clearmodifiers 'ctrl+shift+5'
Chrome doesn't accept the keystrokes if it's not active, so use windowactivate --sync first. It seems that Chrome ignores XTEST events so use --window 0 to force xdotool to use XSendEvent instead. Finally, I had to use --clearmodifiers because I have Caps_Lock and Control_L swapped.

How to get JSON output in Chrome Dev Tools console?

is there a way to output a json in a nice way in the console?
I just get "> Object" as the tree root and have to manually navigate through the tree which is annoying.
The best case would be to search for a string within that object. Alternatively expanding everything would be ok as well.
Any ideas?
(Was asked before in Is there a way in Chrome console to search for strings in console outputs, even those collapsed? but not answered)
Got this from Superuser:
If the right-click -> copy is not available you could try:
1 - Right-click the object and select "Store as global variable"
2 - The console will print the new variable's name, for example:
//temp1
3 - Type:
copy(temp1)
The object is now available in your clipboard.
Tested in chrome 36
I used this in Chrome 65 and worked great.
ATM your best option is to use JSON.stringify as explained here.
There is an DevTools Console API for Chrome extensions that allows to customize console output, but it's still experimental.