Runnning Selenium on Colab is broken again [duplicate] - selenium-webdriver

Few hour ago my setup in google colab for selenium worked fine. Now it stopped working all of a sudden.
This is a sample:
!pip install selenium
!apt-get update
!apt install chromium-chromedriver
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome('chromedriver',
chrome_options=chrome_options)
I get the error:
WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 1
Any ideas on solving it?

This error message...
WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 1
...implies that the chromedriver service unexpectedly exited.
This is because of the of an issue induced as the colab system was updated from v18.04 to ubuntu v20.04 LTS recently.
The main reason is, with Ubuntu v20.04 LTS google-colaboratory no longer distributes chromium-browser outside of a snap package.
Quick Fix
#mco-gh created a new notebook following #metrizable's guidance
(details below) which is working perfect as of now:
https://colab.research.google.com/drive/1cbEvuZOhkouYLda3RqiwtbM-o9hxGLyC
Solution
As a solution you can install a compatible version of chromium-browser from the Debian buster repository using the following code block published by #metrizable in the discussion Issues when trying to use Chromedriver in Colab
%%shell
# Ubuntu no longer distributes chromium-browser outside of snap
#
# Proposed solution: https://askubuntu.com/questions/1204571/how-to-install-chromium-without-snap
# Add debian buster
cat > /etc/apt/sources.list.d/debian.list <<'EOF'
deb [arch=amd64 signed-by=/usr/share/keyrings/debian-buster.gpg] http://deb.debian.org/debian buster main
deb [arch=amd64 signed-by=/usr/share/keyrings/debian-buster-updates.gpg] http://deb.debian.org/debian buster-updates main
deb [arch=amd64 signed-by=/usr/share/keyrings/debian-security-buster.gpg] http://deb.debian.org/debian-security buster/updates main
EOF
# Add keys
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DCC9EFBF77E11517
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 112695A0E562B32A
apt-key export 77E11517 | gpg --dearmour -o /usr/share/keyrings/debian-buster.gpg
apt-key export 22F3D138 | gpg --dearmour -o /usr/share/keyrings/debian-buster-updates.gpg
apt-key export E562B32A | gpg --dearmour -o /usr/share/keyrings/debian-security-buster.gpg
# Prefer debian repo for chromium* packages only
# Note the double-blank lines between entries
cat > /etc/apt/preferences.d/chromium.pref << 'EOF'
Package: *
Pin: release a=eoan
Pin-Priority: 500
Package: *
Pin: origin "deb.debian.org"
Pin-Priority: 300
Package: chromium*
Pin: origin "deb.debian.org"
Pin-Priority: 700
EOF
# Install chromium and chromium-driver
apt-get update
apt-get install chromium chromium-driver

Related

ROS2 Dashing cannot be installed because the public key is not available

OS: ubuntu 18.04
Installation: ROS2 Dashing
Installation date: 2021/05/29
Official documentation
"https://docs.ros.org/en/dashing/Installation/Ubuntu-Install-Debians.html"
I tried to install it referring to the official documentation, but I can't get the apt repository because the public key isn't available.
W: GPG error: http://packages.ros.org/ros2/ubuntu bionic InRelease: The following signatures were invalid: EXPKEYSIG F42ED6FBAB17C654 Open Robotics <info#osrfoundation.org>
E: The repository 'http://packages.ros.org/ros2/ubuntu bionic InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
I tried.
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add-
Another article said that doing this would solve it, so I did it, but it still didn't work.
sudo apt-key adv -keyserver keyserver.ubuntu.com -recv-keys F42ED6FBAB17C654
Has there been another change recently?
please Help me.
Just had a similar issue and for me, this fixed it. Basically, I had add the new repository key and delete the old one. Listing the commands here for convenience:
# add new repository key:
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
# remove old repository key:
sudo apt-key del 421C365BD9FF1F717815A3895523BAEEB01FA116
Hope this helps you as well!
Update: If it does not, please watch these two:
https://answers.ros.org/question/379190/apt-update-signatures-were-invalid-f42ed6fbab17c654/
https://discourse.ros.org/t/ros-gpg-key-expiration-incident/20669/3

selenium with chromium crash with webworker

I am using:
Chromium 73
Chromium ChromeDriver 73
Alpine 3.9
Selenium Java
in CI (in kuberenetes cluster) and I am getting crashes for web driver since I added WebWorker to my application code under test.
Crash Log Here - https://gist.github.com/yosiat/360cb40af0cf7e234a0c6304c8c26ef1
I enabled chrome webdriver verbose logging and I see those lines:
[33751:33751:0709/175416.767497:ERROR:validation_errors.cc(76)] Invalid message: VALIDATION_ERROR_DESERIALIZATION_FAILED (DevToolsAgentHost::ChildWorkerCreated deserializer)
[33751:33761:0709/175416.767545:ERROR:render_process_host_impl.cc(4800)] Terminating render process for bad Mojo message: Received bad user message: Validation failed for DevToolsAgentHost::ChildWorkerCreated deserializer [VALIDATION_ERROR_DESERIALIZATION_FAILED (DevToolsAgentHost::ChildWorkerCreated deserializer)
[33751:33761:0709/175416.767578:ERROR:bad_message.cc(27)] Terminating renderer for bad IPC message, reason 123
[1562694856.784][DEBUG]: DevTools WebSocket Event: Inspector.targetCrashed EBB11FCDAB2DEC02066BF3BCD6FF4F8D {
}
[1562694856.784][INFO]: Done waiting for pending navigations. Status: unknown error: cannot determine loading status
from tab crashed
[1562694856.835][INFO]: [d62047bf581d2bfcc6f681474fb0ea28] RESPONSE Navigate ERROR unknown error: session deleted because of page crash
from unknown error: cannot determine loading status
from tab crashed
(Session info: chrome=73.0.3683.103)
Try launching the chrome with argument '--disable-dev-shm-usage' .
Example JAVA :
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-dev-shm-usage");
Most probably its crashing because of the memory issues. Reference
If above solution is not working then you can try mounting an emptyDir to /dev/shm and setting the medium to Memory
I got exactly the same error while trying to setup nightwatch + chromium + chromedriver in docker. Our project uses Auth0 which in turn uses web workers, some other sites without web workers opened just fine. I used node:10-alpine image and simply installed chrome and chromedriver like this apk add chromium-chromedriver chromium, tried --privileged mode and a bunch of chrome flags but it didn't work.
Then I tried using this as a base (right now it installs chrome 76) https://github.com/GoogleChromeLabs/lighthousebot/blob/master/builder/Dockerfile and it worked. The final dockerfile was something like this
FROM node:10-slim AS test
RUN apt-get update --fix-missing && apt-get -y upgrade
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-stable --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /src/*.deb
RUN npm install nightwatch chromedriver
# copy nightwatch files, etc
And chrome was run with --headless, --no-sandbox and --disable-gpu.

Building mongodb C driver on MacOS

I tried this:
git clone git://github.com/mongodb/mongo-c-driver.git
cd mongo-c-driver
./autogen.sh --prefix=/usr --libdir=/usr/lib64
Output:
Error: libtoolize was not found on your system. Cannot continue.
On Darwin, this is named glibtoolize
Submodule 'src/libbson' (git://github.com/mongodb/libbson.git) registered for path 'src/libbson'
Cloning into 'src/libbson'...
remote: Reusing existing pack: 5211, done.
remote: Counting objects: 66, done.
remote: Compressing objects: 100% (65/65), done.
remote: Total 5277 (delta 35), reused 2 (delta 0)
Receiving objects: 100% (5277/5277), 5.18 MiB | 2.22 MiB/s, done.
Resolving deltas: 100% (3463/3463), done.
Checking connectivity... done.
Submodule path 'src/libbson': checked out '5fafb63060b08c477fa8e243e07de40869de691d'
Error: libtoolize was not found on your system. Cannot continue.
On Darwin, this is named glibtoolize
Error: autoreconf not found, please install it.
Error: autoreconf not found, please install it.
How can I fix this? (Sorry...not normally a C guy, so use small words.)
You need to install libtool. The easiest is to do it with Homebrew. If you don't already have Homebrew installed, you can install it with a simple command:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
You can find more information on the site. When Homebrew is installed, you can install libtool easily:
brew install libtool
You can also use Homebrew package manager for Mac
brew install mongo-c

rails install pg - Can't find the 'libpq-fe.h header

$ sudo bundle install
Result
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Using rake (0.9.2.2)
Using i18n (0.6.1)
Using multi_json (1.3.6)
Using activesupport (3.2.8)
Using builder (3.0.4)
Using activemodel (3.2.8)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.8)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.11)
Using mail (2.4.4)
Using actionmailer (3.2.8)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Using activerecord (3.2.8)
Using activeresource (3.2.8)
Using bundler (1.2.1)
Using coffee-script-source (1.4.0)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.5)
Using rdoc (3.12)
Using thor (0.16.0)
Using railties (3.2.8)
Using coffee-rails (3.2.2)
Using jquery-rails (2.1.3)
Installing pg (0.14.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.8
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
Gem files will remain installed in /var/lib/gems/1.8/gems/pg-0.14.1 for inspection.
Results logged to /var/lib/gems/1.8/gems/pg-0.14.1/ext/gem_make.out
An error occurred while installing pg (0.14.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.14.1'` succeeds before bundling.
I am make $ gem install pg -v '0.14.1' But this is not help
My Gemfile
source 'https://rubygems.org'
#gem 'rails', '3.0.9'
#gem 'sqlite3', '1.3.6', :group => :development
gem 'rails', '3.2.8'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'pg'
gem 'taps'
gem 'json'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
#group :production do
#gem 'pg'
#end
#group :development do
#gem 'sqlite3'
#end
gem_make.out
/usr/bin/ruby1.8 extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.8
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
mkmf.log
find_executable: checking for pg_config... -------------------- yes
--------------------
find_header: checking for libpq-fe.h... -------------------- no
"gcc -E -I. -I/usr/lib/ruby/1.8/i686-linux -I. -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -I -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -o conftest.i"
conftest.c:1:22: fatal error: libpq-fe.h: No such file or directory
compilation terminated.
checked program was:
/* begin */
1: #include <libpq-fe.h>
/* end */
--------------------
Help me please. Thank you.
Sorry for this text.
Your post does not have much context to explain the code sections; please explain your scenario more clearly.
Just make this
$ sudo apt-get install libpq-dev
This is answered in Can't find the 'libpq-fe.h header when trying to install pg gem
Depending on your environment:
Mac: brew install postgresql
Ubuntu: sudo apt-get install libpq-dev
RHEL: yum install postgresql-devel
Alpine: apk add postgresql-dev
Then run gem install pg again
SO: Ubuntu
Language Programming: C
$ sudo apt-get install libpq-dev
In my case I was putting the directory path wrong. So:
From: gcc -o lib_version lib_version.c -I/usr/include/postgresql -lpq -std=c99
To: gcc -o lib_version lib_version.c -I /usr/include/postgresql -lpq -std=c99
GL
Try this:
brew install postgresql
gem install pg
bundle install
On Fedora/RHEL systems this did the trick:
sudo yum install libpqxx-devel
For Alpine Linux, you can add libpq-fe.h with:
apk add postgresql-dev
For Amazon Linux (AWS):
sudo yum install postgresql-devel
then run your command again
On Mac OS X run like this:
gem install pg -- --with-pg-config=***/path/to/pg_config***
***/path/to/pg_config*** is path to pg_config
I had this issue with a Jenkins server on Amazon AMI.
$ pg_config | grep VERSION
VERSION = PostgreSQL 9.4.9
Then depending on which version you need you can install the required lib
$ sudo yum list postgresql* | grep devel
postgresql92-devel.x86_64 9.2.18-1.59.amzn1 #amzn-main
postgresql94-devel.x86_64 9.4.9-1.67.amzn1 #amzn-main
postgresql8-devel.x86_64 8.4.20-5.52.amzn1 amzn-main
postgresql93-devel.x86_64 9.3.14-1.62.amzn1 amzn-main
postgresql95-devel.x86_64 9.5.4-1.71.amzn1 amzn-main
Then you can just install the corresponding version, in my case for version 9.4:
sudo yum install postgresql94-devel
This was happening me using capistrano while deploying my app in a centos7 distro. Apparently gem is requiring some header files which can be resolved installing the right development package.
I fixed it by running sudo yum search postgres | grep devel and found the right package for my postgres installation which was 10.
Then simply run sudo yum install postgresql10-devel, and eureka!
try this:
sudo apt-get install libpq-dev
gem install pg
it would be works!
On mac make sure your postgres is linked.
You can do it by
brew link --overwrite postgresql
This fixed the issue for me.
I use Ubuntu-16. And I use the method showed here:https://www.postgresql.org/download/linux/ubuntu/ to install postgresql-9.6;
And I use "sudo apt-get install libpq-dev" to install the devlib.But It still can't work. So I use the method ln to establish soft link, here it is :
sudo ln -s /usr/include/postgresql/libpq-fe.h /usr/include/;
sudo ln -s /usr/include/postgresql/postgres_ext.h /usr/include/
And I solve the problem at last.
brew install postgresql worked for me.
Installation of postgresql was giving another error
Error: The following directories are not writable by your user:
/usr/local/lib/pkgconfig
/usr/local/share/info
/usr/local/share/man/man3
This error was fixed by giving access to the mentioned directories to the current user
sudo chown -R $(whoami) (path)
This worked for me:
sudo gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
If you've installed postgresql on MacOS via Homebrew
brew install postgresql#95 # 9.5 is the version needed in my project
you may need to find the pg_config depending on your version of libpq
my project needed older version of pg.
gem install pg -v '0.20.0' -- --with-pg config=/usr/local/Cellar/libpq/13.1/bin/pg_config

Mac Ports Update Failing

hansarijanto$ port -v
MacPorts 2.0.3
hansarijanto$ xcodebuild -version
Xcode 4.3.2
Build version 4E2002
I am running the above xcode and macport version. on max os x
when I try to self update my mac port I get the following error.
hansarijanto$ sudo port selfupdate
Password:
---> Updating MacPorts base sources using rsync
MacPorts base version 2.0.3 installed,
MacPorts base version 2.0.4 downloaded.
---> Updating the ports tree
---> MacPorts base is outdated, installing new version 2.0.4
Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl
Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: shell command failed (see log for details)
I am trying to update mac port to install qt.
sudo port install qt4-mac-devel(error no SDK found)
which I need to install webkit-capybara
sudo gem install capybara-webkit -v '0.7.2'(error in setting up native environment)
You need to use the -d option to get enough information to diagnose this; but take a look at https://trac.macports.org/wiki/FAQ#selfupdatefails for common problems and solutions.
Seems Apple no longer installs Xcode's command line tools. See here: http://ericwilson.erics.ws/ericsblog/2012/8/26/macports-port-selfupdate-fail for solution.
Just wanted to add that on Mac OS 10.12 Sierra i was getting the WARNING: GNUSTEP_SYSTEM_ROOT is not defined error on selfupdate and i did already have the Xcode command line tools installed, licensed and working. But my copy of Xcode had become out of date, even though that was not showing up on the automatic software updates.
I had version 7 and for Sierra (and macports) you need version 8.
So I manually downloaded Xcode 8 via the App Store and it solved the problem for me.

Resources