Can Scriptish inject scripts into other chrome: windows? - firefox

As we know Scriptish has the support for the chrome: scheme (although disabled by default), but it failed to inject a user script into other chrome: window (for example, download window, or about window).
Writing a script using #include chrome://foo/bar only works when the browser window opens this page as a tab, but not for a new window with this URL, except the browser window itself, use #include chrome://browser/content/browser.xul does work.
Is there any way to let Scriptish do this just like what uc does? Or is Scriptish just designed like this?

I have resolved it.
Scriptish will insert a toolbar button to browser windows. And every time it wants to inject a script, it checks if the target is alive and if it has Scriptish's UI, if not, it just return.
As a result, although it supports chrome scheme, it only inject scripts into browser windows and chrome page in tabs.
I edited modules\utils\Scriptish_injectScripts.js, removed this check at line 29, now it can inject scripts as their #include meta data.

Related

The browser opened by geckodriver, is not using default settings for running Robot script

I've set layout.css.devPixelsPerPx in Firefox to be 0.9 (open a new tab, write "about:config" & hit Enter), since I want the browser to be opened with certain level of zoom aspect. It is working fine, when I'm opening the browser manually.
But when I run a robot script, it opens the browser with zoomed in instead of the one, already set above.
So far I've tried following options, apart from above -
1. Tried using Firefox extension, which set default zoom level, but the browser opened by Geckodriver, doen't have that extension available.
2. Run Cntrl+- to zoom out, but as soon as the url changes, the zoom is reset to 100%
3. I can have the Browser open with a command (which has the correct zoom level set). Is there a way, I can ask Robot to use the existing instance of browser than opening new one?
How can I have the Robot open the Firefox browser with certain level of zoom?
The reason why you don't see the setting effective when you run the script is because Selenium creates a new profile when it starts a browser.
Any changes you do in your browser, any extensions you add, are stored in your user's profile. Selenium uses a clean/vanilla (as in: having the default settings) profile so your testing environment is always clean - not influenced by customizations, extensions, cached resources you may have added in your daily work.
If you want to have a particular setting changed in your Selenium browser session, under Firefox with Robotframework - you're "in luck" :). The SeleniumLibrary that comes with it supports starting the browser with a precreted profile - see the documentation, the Open Browser keyword - it has an argument ff_profile_dir.
So create a FF profile with your setting set to the value you need (I don't see a reason why it won't be stored there), and pass its directory as parameter to the Open Browser keyword. Thus when Selenium creates a browser instance, it will use this profile, with that setting effective.

Firefox new debugger - Where did the file tab go?

Feel really stupid for asking but where did the file tabs in the debugger go? I can only open one file at a time. If I try to open another one, the file content is simply replaced with the new file. If I revert back to the old debugger, then I have a file tab for each file I open.
Using Firefox 53.0.3 (64-bit) on Ubunto 16.04LTS
You're actually using the old debugger UI. It's the new frontend that allows to open several files at the same time and looks like this:
To toggle the new debugger UI, go to about:config and set the preference devtools.debugger.new-debugger-frontend to true.
You may also check whether browser.tabs.remote.autostart.2 is set to true, which controls whether Firefox runs in multi-process mode.

Chrome extension: debug content script before packaging

I am developing a Chrome extension. It sets/reads local storage, reads the DOM, and sends an Ajax message. But sometimes it never reaches the server and I don't know where it gets stuck. Reloading the page doesn't work, although the extension works if I load another page in the same tab, and the original page will work if I load it in another tab. I use activeTab permission.
How can I debug this? The Chrome tutorial http://developer.chrome.com/extensions/tut_debugging.html only mentions a popup, which I do not have. (I right-click the icon and "Inspect popup" is not visible.)
I have tried plain old F12/sources, but I don't see my extension there, even when it works.
I am on localhost and the extension is not packaged. I am still working in developer mode.
The extension does not show up in developer tools>Sources>Content scripts, maybe because it isn't packaged. I can see the content script from another regular extension.
To see mine I:
Wrote the following as the first line in my script:
debugger;
Before pressing the extension icon, I bring up the developer tools: F12
Now, when I click the extension icon, my script opens under sources/program. It does not do this if the developer tools is not open.

Google Chrome - Cannot debug my script within the <script> tags

In IE I can set breakpoints and debug just fine.
In Chrome I'm able to view the script but I have no options to set a breakpoint in the code, nor is there a "scripts" tab to navigate to for debugging. I'm confused. (Restarted chrome multiple times). I tried also setting a "debugger;" flag in the code, but that didn't work in Chrome.
What I've found that works is the following (in Chrome 21.0.1180.79):
Open the dev tools (ctrl+shift+i), then click the "Sources" tab. Notice the small right pointing arrow in the grey bar, if you click this, it'll show all the .js files loaded.
Here's the trick. Refresh the page (F5) and now all the inline script is available in this section, so you can set breakpoints at your pleasure :)
Add a #sourceUrl comment to your script. Chrome will then list the script in the Scripts / Sources tab in the Chrome DevTools.
There is a pretty good writeup about #sourceUrl on HTML5Rocks: http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
Even though the comment is called #source*Url*, you can put anything you want as a Url. It just needs to be a human-readable string which you'll use to find your script in the list of scripts.

Controlling multiple Internet Explorer windows?

We've got several web-based applications that are launched from our ERP system (SAP R/3 in this case, but since we're using ShellExec, I don't consider this a SAP issue). The problem is that we can either set the IE to "open every URL passed from the ERP system in a new window" or to "reuse any one of the existing IE windows" (same problem with tabs). Both settings are not acceptable for our users: one of the web applications is a rather bulky medical image viewer applet that wreaks havoc if invoked multiple times. The other option is a no-go either because this way opening the image browser for a patient automatically displaces the lab result display for the very same patient and vice versa.
I'd like to have some control over which window may or may not be reused. My idea would be a kind of "window tag" and a helper program that checks if a window with that tag exists - if it does, reuse it, if not create it. So basically
IELauncher SEARCH http://www.google.com
would open a new window and tag it as SEARCH.
IELauncher DEVEL http://stackoverflow.com
would open a second window, tagging it as DEVEL. Then
IELauncher SEARCH http://www.wikipedia.org
would replace the contents of the first (google) window only.
Is this possible at all? Do you have any pointers for me where to start? I don't even know what to look for...
I had to resort to some rather ugly methods - dynamically assembling a HTML page that uses JavaScript and window.open() to open and access a window by name, then close the page executing the JavaScript. Ugly, but at least this way you get the additional benefit of being able to control certain aspects of the browser window like switching of the menu bar, toolbar and location bar.

Resources