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

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.

Related

How to set a custom download path in Chromium in Truclient protocol of Loadrunner

I am trying to record a UI in Truclient protocol using its Chromium extension. As part of my workflow, I am downloading a file by clicking a button on UI. While replaying my script the downloaded file is saved in the default download path of Chrome. I can see the settings of Truclient Chromium browser where the path is editable. But as soon as the "develop" mode is exit, the path resets to the old default (which is also the default in system).
I want to control where my file should be saved after download on the load generator. Any advise is appreciated!
notes -
I am looking for solutions only specific to Chromium and not for IE or Truclient Browser as my UI is only compatible with Chrome.
LR version - 12.6x
Currently as I known, TruClient still do not support customize the download path in Chromium. You could try to switch to TruClientBrowser which is based on Firefox.
Open TruClientBrowser
Navigate to about:config
Add key value as:
Replay and save your script before close the browser
Reopen the script and test the download path again
TC Chrome uses the default download path.
For Windows, this is usually:
C:\userName\Downloads
and can be changed using
Ctrl+E (Open File Explorer) -> Right Click on Downloads -> Click Location -> Change the Path

Do browser cached files no longer show in Firefox Developer Tools?

For me in FF 61, no cached files appear in the Network tab.
I've tested with large images where it is visually obvious if they're being transfered or coming from browser cache. They show up only when transfered but not when coming from cache.
If I filter the Network tab with is:cached or is:from-cache I get a blank list on any website I visit.
Anyone else get this?
Update:
In newer versions of Firefox there's also an option Disable Cache directly in the Network tab. (Thank you #Sebastian Zartner)
Original Answer:
Do following:
Open up dev tools
Hit F1 (this will opens settings panel)
In Advanced settings section (right-bottom col) make sure Disable HTTP Cache (when toolbox is open) is un-checked.
Hit Ctrl+F5 and check Network tab again.
If above doesn't work for you, as #Tom Tromey mentioned in the comment section, first try with new profile and if doesn't work, try to report it as a bug # bugzilla.mozilla.org
If you don't know how to test with new profile, do following:
Head to about:profiles
Using Create a New Profile, create a new profile :p
Open up cmd (on windows) and type firefox.exe -p myprofile -no-remote (replace myprofile with your new profile name)
A new instance of Firefox will be opened that use your new profile, now you can use this new fox as you using Firefox.
if firefox doesn't exist in you PATH, you need to open cmd in Firefox installation folder

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.

Firefox 10.0 disable hot keys using user.js

I'm currently working on a project where I have firefox launching in one of three modes:
normal
full - kiosk mode with only tabs, and home back and forward navigation showing.
Super - kiosk mode no tabs or anything showing just the content window (true kiosk mode)
Now due to time constraints I have implemented via pygtk rather than creating a custom Firefox extension as the requirements of the project would require a new flag adding to the command line in order to identify what mode it was to launch in. The approach I have used works beautifully, Great. . .
However the problem now is how can I disable all of the hot keys i.e. Ctrl + T, etc, without writing a extension. I am unable to use an existing extension because I need the shortcuts available when firefox is in normal mode and as firefox (for the project) can only be started via the command line programatically I would need a flag to determine weather to restrict the hot keys or not.
I was hoping to be able to achieve this using user.js which is placed programatically into the correct profiles when they are created in another bit of my application. I have tried using user.js by modifying accelKey, chromeAccess, contentAccess, generalAccessKey and menuAccessKey and setting their values to 0, which works for menu access but not for anything else.
Finally the Question
Is it possible to disable all shortcuts from user.js or can you only do it through an extension?
No, you cannot disable shortcut keys via preferences. Not all shortcut keys use the configurable Accel modifier, but even the ones that do cannot be disabled via preferences. In case you are interested, the code handling them only recognizes Meta, Alt and Ctrl as valid values, with Ctrl being the default for inputs that aren't recognized. You can try using Meta (the corresponding code is 224), it seems unmapped on PC keyboard. For anything more fancy than that you will need an extension.
I apologize if this sounds like an ad instead of an answer, it's not meant to.
If you do have time constraints and you just want to get a hold of the code you need, there is an open source kiosk project called Webconverger that has already done a lot of the heavy lifting.

From a shell script open a new tab in a specific instance of Firefox

I have a shell script that creates Firefox profiles and then uses them to open multiple instances of Firefox simultaneously. The problem is how can I open a URL in a particular instance of Firefox?
I have tried
firefox -CREATEPROFILE test
firefox -P test -no-remote
firefox -P test -url www.google.ie
But the last part which is trying to open the URL using the test profile does not work, it always opens in the default profile.
Is there any way to tell Firefox from the command line to open a URL using a particular profile?
Thanks.
EDIT: I am using Linux, I don't think its possible to do what I want to do from the command line (However, Firefox command-line options are not fully documented so it could be possible). One solution to my problem would be to use JavaScript to open the tabs once the browser has been executed. I think changing the default profile to the profile I want to open each time I want to load a new URL may work also. This will require changes to profiles.ini each time a new URL is loaded. I haven't tested this but it looks promising.
Yes this can be done, Modify your profiles.ini (/home/username/.mozilla/firefox/profiles.ini) to change the default profile each time you want to open a URL in a different profile.
I know this is a bit of a pain but it works and its the only way to do this. Now I can have multiple Firefox instances/profiles open simultaneously and still open new tabs in which ever instance I want from my shell script.
YAY!
Unfortunately Firefox only supports one remote profile at a time, so all your command lines have to remote into the same process. (Mozilla Suite for Linux supported a per-profile remote, but then again it didn't support the -profile flag.)
On the other hand if you know all the URL(s) that you want to load in advance, then you can simply pass all of them on the Firefox command line, concatenated with | characters (but quoted to stop the shell interpreting them). So for instance if you want to start a new instance of the test profile opening the page www.google.ie (only), use firefox -no-remote -P test -browser www.google.ie

Resources