Selenium error on geckodriver

Problem

I updated Ubuntu packages, which included Firefox and I updated Selenium using pip3 cause that also depends on the Firefox version. But running my existing Python scripts that use Selenium popped this error:

FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver'

Solution

Firefox now provides the geckodriver as a separate binary. You can download the version matching your OS and CPU here. Unzip the file and place the binary anywhere that is in your PATH. Your Python scripts should work now.

Reference

Tried with: Firefox 49, Selenium 3.0.1 and Ubuntu 16.04

How to use KeeFox in Ubuntu

KeeFox is an open-source extension for Firefox to use your KeePass program to fill login-password forms on websites. You could do this manually by opening KeePass and using it to find the login-password or to generate a new password or update the credentials. KeeFox makes it easy to do these operations directly from the browser.

$ sudo apt install keepass2
  • Open KeePass and create a password database and a master password. Get comfortable using KeePass. Configure it to open your default password database file on startup.

  • Install the complete Mono package:

$ sudo apt install mono-complete
  • Make sure you install mono-complete. Just because you have /usr/bin/mono does not mean that this package is installed. If you do not install this, you will later face a plugin incompatibility error.

  • Install the KeeFox extension in your Firefox from here.

  • We now need to create a plugins directory in our KeePass installation and copy the plugin file provided by KeeFox to that location:

$ cd /usr/lib/keepass2/
$ sudo mkdir plugins
$ sudo cp $HOME/.mozilla/firefox/*.default/extensions/keefox@chris.tomlinson/deps/KeePassRPC.plgx plugins
  • Open KeePass. If you had it open, close it and open it again. It should acknowledge that the new plugin that you installed in the above step. Keep it open for the steps below.

  • Open Firefox. Click on KeeFox and go to Options. In the KeePass tab, enter /usr/lib/keepass2 as KeePass location. The Mono location should already be filled in correctly.

  • Restart Firefox. Open the KeeFox Tutorial webpage. Follow the steps there and it shows you how to pull a login-password from KeePass to fill web forms, how to create and update a new password or add a new entry to the database.

Note: After going through these steps I realized that it is far easier to manually use KeePass instead of KeeFox. This is because login-passwords need only be entered once and can be saved for all future logins in Firefox using its built-in password manager anyway.

Tried with: KeeFox 1.5.3, Firefox 42, KeePass 2.25 and Ubuntu 14.04

Firefox does not scroll when selecting text

Problem

I run into so many small, but irritating problems in UI of programs that I wonder if I am the only one affected by them! Here is another one that took a while to figure out.

Someone had sent me a long email that was many pages long. I had it open in Gmail in Firefox. I needed to copy a large portion of this email and paste it into another document.

Ctrl + A to Select All was not a solution since that selects all the text being displayed, including sections of the Gmail UI. A common solution in this situation it to put the mouse cursor at the start of the text, press down the Left button, drag mouse down until it hits the screen bottom and keep dragging until I reach end of the text I want. This highlights and selects the text portion I want and I can now right-click and choose Copy or press Ctrl + c to copy it.

The strange problem was that, this did not work! Keeping Left mouse button pressed I could drag until screen bottom, but the page would not scroll up allowing me to choose the rest of the text!

Solution

It turns out that this happens only in Firefox on Ubuntu. It will only happen when Firefox is shown in a maximized or fullscreen window.

What is happening is that when the mouse cursor is dragged to hit the screen bottom, something in Firefox UI is not indicating that the cursor is trying to move out of the window. Thus, the webpage is not scrolling.

Turns out that this is a known bug, reported here in 2011. Four years on, a good solution is still being debated on.

Until it is fixed, the solution is simple: unmaximize or restore your Firefox window so that it is not fullscreen or maximized. Now try the copy operation, the webpage will scroll and it will work! Voila!

Tried with: Firefox 42 and Ubuntu 14.04

RefControl extension for Firefox

RefControl is an extension for Firefox that can be used to set the value of referer field sent to HTTP servers for certain webpages. This extension is similar to the Referer Control extension for Chrome.

You can change the referer directly in the extension preferences. A more friendly method is to visit the webpage and then click on this extension’s icon and choose RefControl options for this site to set for this specific website. The changes will take effect only if you start browsing from a new tab or might require a restart of Firefox.

More details on the usage of this extension from its author can be found here.

Tried with: RefControl 0.8.17.1, Firefox 41 and Ubuntu 14.04

Live HTTP Headers extension for Firefox

Live HTTP Headers is an extension for Firefox that can be used to view the HTTP headers sent and received when a webpage is loaded. This is useful, for example, to determine what the values in certain header fields are.

Installation requires a reboot. After that, click on the extension icon to open its recording window. Visit the webpage you want to monitor and you can see the HTTP headers logged in this extension window. You can save all the headers to a text file to analyze them.

Tried with: Live HTTP Headers 0.17.1, Firefox 41 and Ubuntu 14.04

HD quality not available in Youtube videos on Firefox

Problem

I was trying to watch the trailer for the upcoming Star Wars movie on Youtube. I noticed that I could get only a maximum of 360p quality video. None of the HD quality options were shown in the video settings!

Solution

I have configured my Youtube to play using HTML5, not Flash. I went to the Youtube HTML5 video player webpage and it showed the status of my browser as:

20151021_youtube_hd_firefox

There are many items that are shown as unsuppported. However, the key item here is H.264, which is required for HD videos on Youtube.

I opened about:config in Firefox and searched for webm. The option media.mediasource.webm.enabled was set to false. Double-click it to set it to true.

Restarted Firefox and checked the HTML5 player status webpage. H.264 now appeared as supported. And my Star Wars trailer played in HD! 😄

Tried with: Firefox 40.0.3 and Ubuntu 14.04

Typing in Firefox address bar loses focus

Problem

I use the address bar in Firefox both to type URLs and to search. Firefox shows a dropdown with suggestions as I type. Seeing that the top result is what I want, I press Enter. Instead of going to the URL it showed as top result, Firefox instead goes to the partially typed text and tries to open or search for that! This is an irritating behavior that goes against how every browser address bar aid the typing user.

Solution

Not surprisingly, I found that this is not a Firefox behavior. Ubuntu installs some extensions to Firefox by default, involving Unity integration and other UI tweaks. Disable these Ubuntu extensions, restart Firefox and your addressbar will work without any hiccups.

Tried with: Firefox 40.0.3 and Ubuntu 14.04

Shareaholic extension for Firefox

Shareaholic is a service for sharing content to different social networks and services. I only use its extension for Firefox from here. This provides me ability to share the current URL to other services, just like I can do in Android.

  • It adds a button to the addressbar. Click it to view your services you can share to and to customize its Options.

  • I recommend going through its Options and enabling only the services you need.

  • I use Shareaholic to share the URL of a webpage I’m viewing using Gmail or Twitter to other friends.

Tried with: Shareaholic 3.0.1.1, Firefox 41 and Ubuntu 14.04

Emoji Cheatsheet extension for Firefox

It has become common to view and add Emoji 😝😈😬 to emails, tweets, blogposts or any text on the web.

Emoji Cheatsheet (also known as Emoji Helper) is a fantastic extension for Firefox that is an emoji picker. It helps to pick emoji from a gallery and insert into any text input or copy to clipboard. The emoji you picked can be inserted as Unicode character, as text code (like that used in Github) or an image (for old applications). Almost all the emoji you see available on your smartphone seems to be in its collection.

  • Emoji Cheatsheet can be installed from here.

  • Check the extension preferences for picking your preferred mode (Unicode, text code or image), keyboard shortcut and other goodies!

Tried with: Emoji Cheatsheet 1.1.1, Firefox 41.0 and Ubuntu 14.04

Keyboard shortcut for bookmarks toolbar in Firefox

Firefox provides the keyboard shortcut Ctrl + B for opening or closing the bookmarks sidebar. Strangely, there is no keyboard shortcut provided to show or hide the bookmarks toolbar. This is irritating since I prefer to use the toolbar over the sidebar.

This functionality can be obtained by installing the Hide BookmarksBar addon. In its Preferences you can set the keyboard shortcut you want. I like to set this to Ctrl + Shift + B, the same as in Chrome.

Tried with: Hide BookmarksBar 3.3.1, Firefox 41 and Ubuntu 15.04