It is a Selenium defect. Problem is in incorrect proxy processing. Default Ubuntu exclusions are located in a no_proxy environment variable:
no_proxy=localhost,127.0.0.0/8
But /8 mask doesn't work for selenium. In order to solve this problem we need to change no_proxy as follows:
no_proxy=localhost,127.0.0.1
You can also remove proxy settings before executing the python script:
http_proxy=python script.py