Emulate click in Google Console for Chrome settings page - google-chrome-devtools

Google chrome settings page prevents me to delete a default search engine (drop down menu allowing to do so does not show up on click in browser). Yet the path to the hidden #delete button is easy to find in the inspector. My problem is to emulate a click in the console.
I've tried many combinations along the lines of:
document.querySelector(path).click();
Here's an example with the full JSpath
document.querySelector("body > settings-ui").shadowRoot.querySelector("#main").shadowRoot.querySelector("settings-basic-page").shadowRoot.querySelector("#basicPage > settings-section.expanded > settings-search-page").shadowRoot.querySelector("#pages > settings-subpage > settings-search-engines-page").shadowRoot.querySelector("settings-search-engines-list:nth-child(11)").shadowRoot.querySelector("#container > iron-list > settings-search-engine-entry:nth-child(3)").shadowRoot.querySelector("#delete").click();
I simply get "undefined" as an error message.
https://i.stack.imgur.com/O3h8f.png
image description: Here's the front end issue I run into when I try to delete the default browser.

Chrome doesn't allow to remove the default engine: it performs the check explicitly in its internal C++ code so you'll have to make another engine a default one beforehand.
And here's a simpler command to delete the engine at index 1, that is the second engine in the list:
chrome.send("removeSearchEngine", [1])

Related

Build pages not showing on admin panel?

As you can see here: [1]: https://i.stack.imgur.com/oVfts.png . I have build some pages from templates but they are not showing in admin panel. When I go for example to : http://sulu-dev.lo/contact, it opens that page.
Are you using the doctrine-dbal transport layer and do you have some kind of special character (dot, dash, ...) in your webspace configuration? There is currently an issue in Jackalope Doctrine DBAL which causes this behavior. Simply change the webspace key, use bin/adminconsole sulu:build --destroy to initialize Sulu again.
The --destroy option deletes all the existing data. If you don't want to do that you should move the /cmf/<webspace> node to match the new key using something like the PHPCR Shell on your own.

Page is not loading properly with editor.html in the url AEM6.1

My page is not loading properly with the url having "editor.html" (http://localhost:4502/editor.html/content/mypage.html). But when I remove editor.html, it loads perfectly (http://localhost:4502/content/mypage.html).
I am using AEM6.1. If I open the page in classic UI, its looks good. But when I open it in touch UI, its not loading properly.
I already have a property "sling:resourceSuperType = wcm/foundation/components/page"
Some of the content is coming on the page.
It can be a JS issue, but even if I remove all the js files from my component, the issue is still there.
Anyone experienced the same issue?
This issue might be due to the 'Apache Sling Main Servlet' default configuration.
And also we can observe the error message 'components could not be loaded' or 'out of memory' in browser console when we are in Touch UI editor Mode.
By default 'Apache Sling Main Servlet' is configured with 1000 calls per request. If we increase this limit then the issue will be resolved.
For updating this follow the steps.
1. Go to the http://<host>:<port-number>/system/console/configMgr (ex: http://localhost:4502/system/console/configMgr)
2. Ctrl + F and Search for "Apache Sling Main Servlet".
3. Change the value of 'Number of Calls per Request' from 1000 (defaulut value) to 1500 or 2000.
4. Click on Save.
5. Now you can go to Touch UI edit mode and can be able to edit the components.
Check in your CRXDE under the folder /libs/wcm/core/content and look for a folder called "editor.html" with the sibling of just "editor". If you delete the editor.html folder and keep "editor", then your page will start working again.

Dynamically loaded javascript doesn't show in sources panel?

For example, I have an ajax request and it returns <script src='buggy.js'></script>.
Problem is, it doesn't show up in sources or resources panel. That means I can't do all the cool stuffs like adding breakpoint and inspecting the elements as they run.
I could only see the source of the js file under the Network panel.
Is there anyway to make chrome add them to the sources panel?
Or how do you guys go about debugging dynamically added scripts?
Using Canary.
I was having the same problem, and I found a workaround that is better than the deliberate exception. It does still require changing the code as opposed to just setting a breakpoint inside the chrome dev tools.
I tried using the "//# sourceURL=dynamicScript.js" that was suggested as a workaround by the OP, but it still wasn't showing up for me unless it already existed in my tabs from a previous time when it produced an exception.
Coding a "debugger;" line forced it to break at that location. Then once it was in my tabs in the Sources panel, I could set breakpoints like normal and remove the "debugger;" line.
Please refer to https://developer.chrome.com/devtools/docs/javascript-debugging#breakpoints-dynamic-javascript
(Original link is broken-- archived link below)
http://web.archive.org/web/20141016164821/https://developer.chrome.com/devtools/docs/javascript-debugging#breakpoints-dynamic-javascript ("Breakpoints in Dynamic JavaScript").

Can't see dynamically loaded code in Chrome Developer Tools 22

When I dynamically load a snippet of html containing javascript via AJAX, I cannot see that content in the source tab in the developer tools window in Chrome 22.0.1229.94. Tellingly, I went here
https://developers.google.com/chrome-developer-tools/docs/scripts-breakpoints#js_dynamic
This page shows an example developer tools window which is out of date. There is a button on the page to load a dynamic script and it does not show up in the source tab when you do.
As a work-around, I have found that adding
debugger;
to the script and reloading it will cause it to pause in the dynamically loaded code, but unfortunately, all the line numbers are greyed out and you can't set any breakpoints within the debugger.
Am I missing something here or what?
Thanks,
Rob
When you use a library or javascript code that you have loaded it dynamically, you can use the phrase
//# sourceURL=foo.js
at the beginning of your javascript code that foo.js is the name that will be assigned it. debugger will show it with that name.
This is true in chrome, and I think in firebug too.
In this case you can place a breakpoint in the dynamically loaded javascript code.
Possible duplicate of:
Is possible to debug dynamic loading JavaScript by some debugger like WebKit, FireBug or IE8 Developer Tool?
Don't know if this works or not in chrome (This definitely doesn't work for me now, may be in the past).
//# sourceURL=foo.js
Working Solution
For your dynamically loaded script via ajax to appear in your chrome source tool, you need to add the following line at the start or end (I prefer) location of your script file:
//# sourceURL=foo.js
And your script with name foo.js will appear at the left pane of source tab under (no domain) dropdown
->localhost
-- source/src
->(no domain)
-- foo.js
Alternatively you can add the below line in your script anywhere between the scripts.
debugger;
In chrome, you can use " debugger; " statement to break at a statement when debugger panel is open. Chrome will simply ignore this if the debugger panel is closed.
This will help stop your script in debugging mode and you will see your script in source (debugging) panel with name like VM****.
Hope this helps.
You can use //# sourceURL. Chrome doesn't seem to be supporting //# sourceURL for inline scripts. However, it does work on eval expressions. This article gives more details about naming eval blocks and naming of any anonymous functions in your code.
Instead of using eval, you can try embedding a script tag or JSONP may be.
Varunkumar Nagarajan
for me it happened on nodejs project.
i restarted server and open in new tab my app and tada!..
Alternatively, to fix this problem you can open developer tool in a seprate window by clicking the icon. Now reload your script, and it will shown in script tab as expected. I know this is not a solution but a work arround.

Change default browser in Visual Studio 2010 RC

In Visual Studio 2010 (RC) there is no longer a "browse with" context menu when right clicking .aspx pages. How can you change the default browser now?
By default it seems to use the operating system default browser, but I would prefer to use IE when debugging ASP.net apps. (I am testing this with ASP.net MVC 2)
this is the only working way for me:
How do I set my development web browser in VS2010 RC?
There is also a browser switcher extension for Visual Studio, which works perfectly!
http://visualstudiogallery.msdn.microsoft.com/bb424812-f742-41ef-974a-cdac607df921
update:
the extension is removed from the gallery, try this one:
http://visualstudiogallery.msdn.microsoft.com/233945ae-0b7b-47e7-9b02-c5a11798afb5
this browser switching extension is what i use. It's pretty awesome.
EDIT: Possible new link
There is no "Browse With" option on the .aspx Views in an MVC project as they are not meant to be directly browseable.
What I tend to do is add a Default.aspx webform in the root of the site and this, when right clicked, will give you the Browse With option. You need to make sure to update your routing though otherwise IIS/Cassini will try to serve it up, something like this
public void Page_Load(object sender, System.EventArgs e) {
// Change the current path so that the Routing handler can correctly interpret
// the request, then restore the original path so that the OutputCache module
// can correctly process the response (if caching is enabled).
string originalPath = Request.Path;
HttpContext.Current.RewritePath(Request.ApplicationPath, false);
IHttpHandler httpHandler = new MvcHttpHandler();
httpHandler.ProcessRequest(HttpContext.Current);
HttpContext.Current.RewritePath(originalPath, false);
}
Also, another quicky is to hit CTRL-F5 (run without debugging) which will fire up the site without going into debug mode..
I just added a .htm page and right clicked on it. There I had Browse With...
The solution really is not that difficult, though it is not as direct as it ought to be...
In Visual Studio 2010, the Browse With option is available. However, it is not available for MVC Views!
Simply add a Web Form or HTML Page to your project, and Browse With is readily available in it's context menu. Here you can set the Default Browser, and that setting will be used for all subsequent debugging.
No need for complicated code in an Default.aspx page, or changing the Windows defaults.
Looks like this is going to be in a future release.
https://connect.microsoft.com/VisualStudio/feedback/details/533930/default-browser-setting-in-vs2010-not-per-project-helps-debug-user-experience
btw, you can change your default browser:-
In WindowsXP atleast..
Go to Start > Control Panel > Add and Remove progam> Set Program access and defaults > Choose IE from the Web browser dropdown.
Edited:
btw, I did see the "Browse with" item in the right click of an aspx page. When I click on that, I see the list of broswers to choose from. You select one an click "Set as default".
Check this out:
How do I set my development web browser in VS2010?
I'm using VS 2010 RC and I can't see the "Browse with..." option too.
"Browse With.." is available on VS2010.
Left Click the empty space of top panel -> select "Web Browser".
Right click .aspx, "Browse With.." is accessible now.
Go to :
C:\Users\[Your current user]\AppData\Local\Microsoft\VisualStudio\10.0\browsers.xml
clear all contents and save
------if your default browser at the windows is IE new settings change to IE -----
Compile your application
another way (and more easy) that we can do this is:
open the browser that you want, for example, IE and going in
Tools > Options > Programs > and click the button like "Set Default Browser"