install selenium via command or website? - java

I need help with knowing whether the best way to install selenium is via command line on Mac, or via the selenium website. Same for chrome or IE.exe, should that be installed via command line or the actual website?
If you recommend installing via the website how would that work out for running tests via CI (Jenkins) on other machines - we would practically need to install selenium/ or browser.exe on every machine right? Which is why I thought it may make more sense to install all this via command line.
Either way, any opinions would be greatly appreciated.

1) For run by Jenkins, the better way it's to setup a selenium grid follow guide: https://github.com/SeleniumHQ/selenium/wiki/Grid2
with seleniu grid, you not need to setup selenium on each jenkins salve. because
grid will supply browser machine for your test.
2) For run/debug on local, i recommend a way to setup selenium and chrome.exe/IE.exe by webdriver-manager, which is a Nodejs package.
so you need to install NodeJS firstly.
a. install nodejs:https://nodejs.org/en/download/package-manager/#macos
b. execute 'npm install -g webdriver-manager' in terminal
c. execute 'npm config get preifx', it will print out a path in terminal
d. export above path in PATH environment
e. execute 'webdriver-manager version' to check PATH evnrionment work as expect
3) the command to install selenium stuffs like:
webdriver-manager update --verions.standalone=3.4.0 --versions.chrome=2.30 --versions.ie=
or just webdriver-manager update , this will install latest version of selenium server jar and chromedriver.exe for chrome and geckodriver.exe for firefox.
A reminder: latest version may not compatible with your local browser. so I think you need use options: --versions.xxxx=xxxxx to install certain version.
if latest version not caompatible with your local browser, and you want to start a selenium server, you also need to append the versions options like used in update:
webdriver-manager start --versions.chome=xxxxx (if you need run with chrome)
--versions.gecko=xxxx (if run with firefox) --version.ie=xxxx (if run with ie)
all avaiable options you can get by execute webdriver-manager help as below:
webdriver-manager update --ie

Related

How to execute Carrot2 Document Clustering server

I downloaded the Carrot2 Document clustering server build 3.15.0 for Mac. The read me file says:
The DCS requires a Java Runtime Environment (JRE) version 1.7.0 or later. To
run the DCS, execute the 'dcs' script and point your browser at
http://localhost:8080 for further instructions.
Mac OS Sierra doesn't make it easy, but I got 1.8.0_112 installed.
The problem is that I don't know how to execute the 'dcs' script.
There are .cmd, .sh, .war, and .jar files. I wasn't sure which of those to work with. I thought .jar looked promising, so I followed some of this thread and tried this in a terminal window:
java -jar invoker.jar
I cd-ed to the correct directory, but it just says Provide main class, but I'm not sure what or where that is.
Can anybody provide instructions or a link to how to do this?
Use the dcs.sh (on Linux/Mac) and dcs.cmd (on Windows) to start the server. The scripts will set some extra options for the JVM and then start the DCS. In case of any problems, append the -v option to see diagnostic output.

Problems about Jenkins running remote shell script

I have some question when using jenkins.
the scenario:
I have installed a tomcat on machine A,and config all necessary environment including JDK, and they work well.
I wrote a shell script named restart.sh to kill the tomcat process,and restart.
I execute the script and it works well.When I check the tomcat process using ps -ef,and it shows the exact JDK path as I already config.The JDK path is /usr/local/java/JDK7
When I execute the restart.sh script via jenkins,problem comes. I can see the tomcat process using the wrong JDK path,/usr/bin/java,not the path as i config. I use SSH Publishers plugin to run the remote script.see as the image below:
enter image description here
I don't know how this problem happen,please help,Thanks all
This might be the problem of path variables, just to cross verify , find JAVA_HOME on your server 1. By logging onto server manually 2. From Exec command of your ssh section of your jenkins job , most probably you will find the answer.
i'm assuming you're jenkins is configured to use jdk which is defined at its root level.
if this didn't solve , we need to look into this problem from another angle.

How to add appium server in eclipse workspace

I have requirement like i don't want to install appium in my machine with the help of (npm install -g appium) So i want to run appium commands in command line mode with the help of node-modules. So in this consideration how can i add this into my eclipse project. I am looking exact like selendroid server jar configuration Does we have this kind of flexibility with appium.
As simple as i am looking every thing(Appium server should start from eclipse work space) should be in my eclipse project only for all platforms(Linux, win, mac).
Thanks in advance

Error running 'webdriver-manager start' on Windows 8.1

I am attempting to run end-to-end test for an angular project using protractor and am getting the following error when I run the command 'webdriver-manager start'
I have run webdriver-manager update, and selenium standalone and chromedriver are up to date.
I have java installed. java -version returns
I also have the path to java in my system environment variables (C:\Program Files\Java\jre1.8.0_31\bin)
Does anyone have any idea how to fix this error?
You can also start the web driver as below,
java -Dwebdriver.ie.driver=D:\Selenium_download_New\IEDriverServer.exe -jar D:\Selenium_download_New\selenium-server-standalone-2.45.0.jar
java -Dwebdriver.chrome.driver=D:\Selenium_download_New\chromedriver.exe -jar D:\Selenium_download_New\selenium-server-standalone-2.45.0.jar
Note the Standalone.jar should be placed in the exact location as above, you can also download the standalone.jar from selenium website
I had the same issue. Probably the webdriver update you are running is installing Selenium required files in another folder that it isn't inside your project folder. At least that was my case.
I was using a grunt task for running Protractor tests. If you are using the same plugin check this folder:
C:\{yourprojectfolder}\node_modules\grunt-protractor-runner\node_modules\protractor\selenium
If you don't find that folder then you are under the same issue as me. Try with another bash. You're using cmd, try with Git Bash. Locate yourself in the following directory:
C:\{yourprojectfolder}\node_modules\grunt-protractor-runner\node_modules\protractor\bin
Then run:
webdriver-manager update
Finally check the selenium folder inside your Protractor plugin. It should be created now.
I didn't have time to find why cmd is behaving different than Git Bash when running the same command inside the same folder. Each one installs the Selenium files in different places.
Maybe you are missing a system variable(C:\Windows\System32\ variable.). Adding this variable would solve your problem.
Hope, it helps!
Add "C:\Windows\System32\" to your PATHs.
On windows, right-click My Computer -> Properties -> Advanced system settings -> Environment Variables -> Edit... PATH and add "C:\Windows\System32\" to the end (with a semi-colon separating each variable).
Otherwise
SET PATH=%PATH%;C:\Windows\System32
Then start web driver using below command
webdriver-manager start
SPAWN command is not available in windows.
Install git. git bash will be installed too.
Now add git bash path to the PATH environment variable.
Restart your command prompt and it will run.

Jenkins can't launch selenium tests (Timed out waiting for profile to be created)

Jenkins can't launch selenium tests (ubuntu)
error
11:26:24.652 INFO - Started org.openqa.jetty.jetty.Server#ab50cd
11:26:24.738 INFO - Preparing Firefox profile...
HTML suite exception seen:
java.lang.RuntimeException: Timed out waiting for profile to be created!
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:360)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirectory(FirefoxChromeLauncher.java:114)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:83)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchHTMLSuite(FirefoxChromeLauncher.java:405)
at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchHTMLSuite(FirefoxLauncher.java:105)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:121)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:166)
at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:556)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:241)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:201)
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:40)
OS - Ubuntu workstation 11
Jenkins & Selenium - last versions (installed as is it written on sites)
It seems to me that user jenkins have not all the rights, because if i use the same line to execute in terminal, it works selenium starts Firefox & do the suite.
I also put jenkins user in groop root but it also doesn't help.
I'm not qualified in Linux but it seems than trouble is with rights of jenkins user, but i can mistake.
If somebody have solved the problem please write the solution.
I was recently having this issue too.
I first tried the method mentioned here : http://www.spacevatican.org/2008/9/27/selenium-and-firefox-3 However this fix now seems out of date, as the plugin maxVersion properties were all set to 8.something.
The way I fixed it (as mentioned here : http://www.centripetal.ca/blog/2011/02/07/getting-started-with-selenium-and-jenkins/) was to provide Selenium with a firefox profile.
Steps
Open up Firefox profile manager : $ firefox -ProfileManager
Create a new profile, called Selenium
Now, when running the selenium command, add "-firefoxProfileTemplate "/home/{username}/.mozilla/firefox/{profile dir}" to the command. (where {username} is your username and {profile dir} is the profile directory, which for me was "6f2um01h.Selenium"
My final Selenium command was
$ sudo java -jar /var/lib/jenkins/tools/selenium/selenium-server.jar -htmlSuite *firefox http://google.com "/var/lib/jenkins/jobs/Selenium setup test/workspace/tests/test-testsuite.html" "/var/lib/jenkins/jobs/Selenium setup test/workspace/results/results.html" -log=/tmp/selenium.log -debug=true -firefoxProfileTemplate "/home/username/.mozilla/firefox/6f2um01h.Selenium"
I would also recommend copying and pasting the shell command that jenkins is using into Terminal, to save having to run it through Jenkins each time.
N.B. I'm currently finding that Selenium now hangs (and doesn't crash) on the next step of it's process (Launching Firefox) but this seems like a different bug which I've added to stackoverflow here : Selenium hangs when launching Firefox on Ubuntu
I have similar issues. But the cause and solution are different.
The program (I use python) hangs for a while, and then output:
selenium.common.exceptions.WebDriverException: Message: 'The browser
appears to have exited before we could connect. The output was: *
LOG addons.xpi: startup\n* LOG addons.xpi: checkForChanges\n*** LOG
addons.xpi: Opening database\n*** LOG addons.xpi: No changes
found\nFailed to dlopen /usr/lib/libX11.so.6\ndlerror says:
/usr/lib/libX11.so.6: wrong ELF class: ELFCLASS32\n'
It is because I have installed both 32 and 64 bit version of libX11. By removing libX11 32 bit version, the program works.
#mattbilson's solution didn't work for me, but I found a different solution to a problem with the same symtomps. I believe In the process of trying to debug the problem, multiple versions of Firefox had been installed, and not all from clean deb packages.
To fix the problem I did:
sudo apt-get purge firefox
sudo mv /usr/lib/firefox /usr/lib/firefox.bak
sudo apt-get install firefox=<MY_FIREFOX_VERSION>
After that I could run the Selenium JAR without any special parameters.

Categories

Resources