Build chromedriver for linux - selenium

I'm trying to build chromedriver from source for use in selenium for Linux.
i use this manual https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_instructions.md
but when i build without any error my chromedriver less for 2mb that if i download form google code site. and this chromedriver not work with selenium. just blank error.
Have someone any idea what wrong? Thank You

We'd need more information... Here is a dockerfile (largely taken from here) that worked for me. Most of the commands come from the chromium build docs.
FROM ubuntu:14.04
# Install Chromium build dependencies.
RUN echo "deb http://archive.ubuntu.com/ubuntu trusty multiverse" >> /etc/apt/sources.list # && dpkg --add-architecture i386
RUN sudo apt-get update && apt-get install -qy git build-essential clang curl
# Install Chromium's depot_tools.
ENV DEPOT_TOOLS /usr/bin/depot_tools
RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git $DEPOT_TOOLS
ENV PATH $PATH:$DEPOT_TOOLS
RUN echo -e "\n# Add Chromium's depot_tools to the PATH." >> .bashrc
RUN echo "export PATH=\"\$PATH:$DEPOT_TOOLS\"" >> .bashrc
RUN git config --global https.postBuffer 1048576000
# Download Chromium sources.
RUN fetch --nohooks --no-history chromium
WORKDIR /
RUN gclient runhooks
WORKDIR src
RUN build/install-build-deps.sh --no-prompt
RUN gn gen out/Release --args="is_debug=false"
RUN ninja -C out/Release chromedriver
RUN cp out/Release/chromedriver /usr/bin/chromedriver
WORKDIR /

Related

Why is brew install redis not working for mac M1?

I have to install redis, but it is not working to install redis anymore using brew. Getting the following error when trying to install this way:
Warning: No available formula with the name "redis".
==> Searching for similarly named formulae and casks...
==> Casks
another-redis-desktop-manager ✔ redis-pro
jpadilla-redis redisinsight
medis
To install another-redis-desktop-manager ✔, run:
brew install --cask another-redis-desktop-manager ✔
Tried the command brew install --cask another-redis-desktop-manager.
This also didn't work.
Actually found the answer. Basically the reason for the failure in installation was because the core homebrew packages were not correctly configured.
Identified the issue with brew doctor
The solution was
rm -rf "/opt/homebrew/Library/Taps/homebrew/homebrew-core"
brew tap homebrew/core
ARM Homebrew must be installed in the /opt/homebrew directory. Earlier, you need to manually create directories and run commands. However, you do not need to manually run commands to use the latest scripts.
Direct execution:
/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"
PS: terminal type Run the echo $SHELL command. The command output is as follows:
/bin/bash => bash => .bash_profile
/bin/zsh => zsh => .zprofile
If you encounter invalid environment variables, you are advised to check the terminal type before setting the correct environment variables.
Starting with macOS Catalina(10.15.x), Macs use zsh as the default Shell, using.zprofile, so the corresponding command:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
If you have macOS Mojave or later and have not configured zsh yourself, use.bash_profile:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.bash_profile
eval "$(/opt/homebrew/bin/brew shellenv)"
Hope this can help you

How to test API from a ROS1 package that works with another ROS2 package?

I have found one ROS1 git repo/package. But it was tested with confirmed ROS Version : ROS Melodic Morenia and Ubuntu 18.04 LTS. So it can be build with catkin_build. Using the following commands
$ cd ~/
$ mkdir --parents catkin_ws/src
$ cd catkin_ws
$ catkin init
$ catkin build
A reference site about vcstool that builds packages after installing dependent packages and overlays your workspace on the installation environment
$ cd ~/catkin_ws/src
$ git clone https://github.com/ros1-package.git
$ sudo apt update
$ sudo apt install python-vcstool python-rosdep python-catkin-tools
$ git clone https://github.com/strv/vcstool-utils.git
$ rosdep install --from-paths ~/catkin_ws/src --ignore-src -r -y
$ ./vcstool-utils/import_all.sh -s .rosinstall ~/catkin_ws/src
$ catkin build
$ source ../devel/setup.bash
Then I have my own repo/package but it uses ROS2. I would like to try and test the existing API of the first ROS1 git repo/package to see if its works together with my own ROS2 package. Would appreciate a help how can proceed and how can test/try the API of the first ROS1 package with my own ROS2 package. Any help?
You can use the ROS 1 to ROS 2 bridge: https://github.com/ros2/ros1_bridge

How do I install NPM on a Chromebook?

I installed NodeJS (via Linux terminal) but it doesn't seem to come bundled with NPM:
:~$ sudo apt-get install -y nodejs
:~$ node -v
:~$ v10.23.1
:~$ npm -v
:~$ -bash: npm: command not found
I have an Acer Chromebook R 13 with an ARM processor.
Installing NodeJs
sudo apt-get install curl gnupg -y
curl -sl https://deb.nodesource.com/setup_13.x | sudo -E bash -
sudo apt-get install -y nodejs
In my case I didn't have the install script for npm, so got it externally
curl -L https://npmjs.org/install.sh | sudo sh
nvm is recommended on the npmjs.com install page, and nvm has installation instructions of using an install script.
Open the Terminal app on Chromebook.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
nvm install node
npm is now ready.
Due to trying to answer in comments i will attempt to give a complete answer here.
You need to first aquire the correct package for your architecture. As you have noted you are using the Acer Chromebook R13. This uses the MediaTek MT8173C processsor which utilizes ARMv8 instruction set.
following these commands should get you up and running.
#first, download the proper package for your architecture
mkdir myNodeJS
cd myNodeJS
wget https://nodejs.org/dist/v14.15.5/node-v14.15.5-linux-arm64.tar.xz
tar -xf node-v14.15.5-linux-arm64.tar.xz
cd node-v14.15.5-linux-arm64
cd bin
sudo cp node /usr/local/bin
cd ..
cd /lib/node_modules/npm/scripts
./install.sh
That should be it, if you have problems, you can resort to the first link that i sent for install instructions

Issues while implementing jenkins docker image+chrome+ruby unknown error: Chrome failed to start: crashed (Selenium::WebDriver::Error::UnknownError)

I am trying to setup jenkins using the official jenkins docker image.
Dockerfile
FROM jenkins/jenkins:lts
USER root
RUN apt-get update && apt install -y ruby-full
RUN apt-get install -y curl
RUN apt -y autoremove
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN apt-get install -y nodejs
RUN apt-get install -y build-essential
RUN apt install -y wget
RUN gem install --no-ri --no-rdoc --format-executable rake
RUN gem install selenium-webdriver
RUN gem install bundler
RUN npm install -g node-mongo-seeds
#Permissions granted to jenkins user to do a gem install
RUN chown -R jenkins:jenkins /var/lib/gems
RUN apt-get install -y patch ruby-dev zlib1g-dev liblzma-dev
RUN chown -R jenkins:jenkins /usr/local/bin
# We need wget to set up the PPA and xvfb to have a virtual screen and unzip to install the Chromedriver
RUN apt-get install -y wget xvfb unzip
# Set up the Chrome PPA
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
# Update the package list and install chrome
RUN apt-get update -y
RUN apt-get install -y google-chrome-stable
# Set up Chromedriver Environment variables
ENV CHROMEDRIVER_VERSION 2.35
ENV CHROMEDRIVER_DIR /chromedriver
RUN mkdir $CHROMEDRIVER_DIR
# Download and install Chromedriver
RUN wget -q --continue -P $CHROMEDRIVER_DIR "http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip"
RUN unzip $CHROMEDRIVER_DIR/chromedriver* -d $CHROMEDRIVER_DIR
# Put Chromedriver into the PATH
ENV PATH $CHROMEDRIVER_DIR:$PATH
USER jenkins
While running the job the browser won't open and hit the localhost.
I tried hitting 'google.com' as well
google-chrome --headless --no-sandbox 'https://www.google.com'
still no success
Fontconfig warning: "/etc/fonts/fonts.conf", line 100: unknown element "blank"
[0531/130727.949511:ERROR:browser_process_sub_thread.cc(217)] Waited 17 ms for network service
I am not able understand why jenkins user not able to open the browser.
Google Chrome 74.0.3729.169
ChromeDriver 2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881)
ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]
Jenkins 2.164.3
This error message...
unknown error: Chrome failed to start: crashed (Selenium::WebDriver::Error::UnknownError)
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=2.35
Release Notes of chromedriver=2.35 clearly mentions the following :
Supports Chrome v62-64
You are using chrome=74.0
Release Notes of ChromeDriver v74.0 clearly mentions the following :
Supports Chrome v74
So there is a clear mismatch between ChromeDriver v2.35 and the Chrome Browser v74.0
Solution
Upgrade ChromeDriver to current ChromeDriver v74.0 level.
Keep Chrome version at Chrome v74 level. (as per ChromeDriver v2.46 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
Execute your #Test.
So as per #DebanjanB comment it resolved the driver issues but as per the new issue of chrome crashing I resolved it by just adding
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('--headless')
options.add_argument('--disable-gpu')
options.add_argument('--no-sandbox')
d = Selenium::WebDriver.for :chrome, options: options

implement janus gateway for webrtc

I am following janus documentation to build a video mcu system. I installed all the dependencies of it according to the read me file.
http://janus.conf.meetecho.com/docs/
after that when I run the script using sh install.sh I am getting following error
In file included from test.c:1:0:
../websock/src/websock.h:55:26: fatal error: event2/event.h: No such file or directory
#include <event2/event.h>
^
compilation terminated.
make[1]: *** [test.o] Error 1
make[1]: Leaving directory `/home/gayan/MyDetails/MyApplications/virtualClassRoomTest/janus-gateway/wstest'
make: *** [wstest] Error 2
The installer couldn't find the libwebsock lib, which is needed for WebSockets
You can install version 1.0.4 (required!) with the following steps:
wget http://paydensutherland.com/libwebsock-1.0.4.tar.gz
tar xfv libwebsock-1.0.4.tar.gz
cd libwebsock-1.0.4
./configure --prefix=/usr && make && sudo make install
[Note: you may need to pass --libdir=/usr/lib64 to the configure script if you're installing on a x86_64 distribution]
If you're not interested in WebSockets support, you can disable them passing nowebsockets to the install script:
./install.sh nowebsockets
I also install the libwebsock according to the above steps, but still the error is showing. event2 directory is not in the janus-gateway codes. here is the github link for all the source code. https://github.com/meetecho/janus-gateway.git
Any kind of help would be appreciated.
The full installation steps to have websockets working(Ubuntu 14) are:
mkdir -p ~/build
sudo apt-get install libmicrohttpd-dev libjansson-dev libnice-dev libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev libopus-dev libogg-dev libini-config-dev libcollection-dev libwebsockets-dev pkg-config gengetopt automake libtool doxygen graphviz git cmake
sudo apt-get install libavformat-dev
echo "Start installing libwebsockets"
cd ~/build
git clone git://git.libwebsockets.org/libwebsockets
cd libwebsockets
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DLWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT=ON ..
make && sudo make install
echo "Start installing Janus"
cd ~/build
git clone git://github.com/meetecho/janus-gateway.git
cd janus-gateway
sh autogen.sh
./configure --disable-data-channels --disable-rabbitmq --disable-docs --prefix=/opt/janus LDFLAGS="-L/usr/local/lib -Wl,-rpath=/usr/local/lib" CFLAGS="-I/usr/local/include"
make && sudo make install
sudo make configs
Make sure to copy certificates if using wss, chrome is really picky about that stuff. If using self signed certificates you have to trust them in chrome(very intuitive procedure:)))
sudo cp mycert.pem /opt/janus/share/janus/certs/
sudo cp mycert.key /opt/janus/share/janus/certs/
I had this problem and solve it after
sudo apt-get install libevent-dev
My system is ubuntu 14.04 64 bit