Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor test picking up edge browser instead of chrome after reboot

I was trying to get a server installed with headless chrome, selenium webdriver and protractor for automating tests.

I setup my environment with these instructions:

# JDK 8
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update && sudo apt-get install openjdk-8-jdk

# Node JS
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
sudo apt-get install -y nodejs

# NPM modules
sudo npm install protractor -g
sudo npm install chromedriver -g

# Google Chrome
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install libxpm4 libxrender1 libgtk2.0-0 libnss3 libgconf-2-4
sudo apt-get -y install google-chrome-stable
sudo apt-get -y install xvfb gtk2-engines-pixbuf
sudo apt-get -y install xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable
sudo apt-get -y install imagemagick x11-apps
Xvfb -ac :99 -screen 0 1280x1024x16 &
disown $1
export DISPLAY=:99

The issue is that when I run my protractor test for the first time, it works great and the tests run perfectly. But when there is a server reboot or something, I cant seem to run it again. Now this is because when I am do a webdriver-manager start, this is my output:

yeshwanthvshenoy@node-3:~$ sudo webdriver-manager start
[02:59:54] I/start - java -Djava.security.egd=file:///dev/./urandom -Dwebdriver.chrome.driver=/usr/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.29 -Dwebdriver.gecko.driver=/usr/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.16.1 -jar /usr/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.4.0.jar -port 4444
[02:59:54] I/start - seleniumProcess.pid: 2239
02:59:54.729 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'
02:59:54.730 INFO - Launching a standalone Selenium Server
2017-06-07 02:59:54.758:INFO::main: Logging initialized @329ms to org.seleniumhq.jetty9.util.log.StdErrLog
02:59:54.832 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
 registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform LINUX
02:59:54.833 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
 registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX
02:59:54.833 INFO - Driver class not found: com.opera.core.systems.OperaDriver
02:59:54.833 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped:
Unable to create new instances on this machine.
02:59:54.837 INFO - Driver class not found: com.opera.core.systems.OperaDriver
02:59:54.837 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
02:59:54.842 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
 registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform LINUX
2017-06-07 02:59:54.892:INFO:osjs.Server:main: jetty-9.4.3.v20170317
2017-06-07 02:59:54.942:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@523884b2{/,null,AVAILABLE}
2017-06-07 02:59:54.968:INFO:osjs.AbstractConnector:main: Started ServerConnector@2d653761{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-06-07 02:59:54.969:INFO:osjs.Server:main: Started @541ms
02:59:54.969 INFO - Selenium Server is up and running

As you can see, it shows the edge browser instead of chrome. Why is that it is being switched back? Is there a way to store this permanently or should I do some other command to specify that I need to use chrome?

like image 726
JackSlayer94 Avatar asked Jun 07 '17 03:06

JackSlayer94


People also ask

Does protractor support edge browser?

Afterwards, protractor connects to the Edge server and is able to run the tests.

What is protractor browser?

Browser API is one of the most used API in Protractor, most of the code always dependent on Browser API. Browser API not just controls the operation of browser methods but also all the webdriver related activity will be taken care of by this. In Protractor, "browser" is an instance of ProtractorBrowser class.


1 Answers

I see that IE, Edge, Safari, and Opera are skipped (which is to be expected). After starting the WebDriver manager, go to http://localhost:4444/grid/console and check what has been registered.

Check out Setting Up the Browser for Protractor.

like image 165
Timothy Cope Avatar answered Sep 24 '22 06:09

Timothy Cope