Selenium and Jenkins integration on centos

Source: Internet
Author: User

1. Environment required

Centos Linux release 6.0 (Final )(CAT/etc/RedHat-release)

JDK: jdk1.6.0 _ 27 (/opt /)

Apachetomcat: APACHE-Tomcat-6.0.33 (/opt /)

1.1 extract JDK and Apache Tomcat (Tar xvf * .tar.gz)

1.2 set environment variables like below:

1.2.1 nano~ /. ProfileOr/etc/. Profile (NanoIs better than vi, we can install it usingYum install nanoIn centos)

Java_home =/opt/jdk1.6.0 _ 27
Classpath =.: $ java_home/lib/tool. Jar
Ant_home =/opt/Apache-ant-1.8.2
Display =: 1.0
Path =: $ ant_home/bin: $ java_home/bin: $ path
Export lang = "en_us.utf8" java_home classpath path

1.2.2 source ~ /. Profile

1.2.3 verify if set successful usingEcho $ java_home

1.3 start Apache

CD/opt/Apache-Tomcat-6.0.33/bin

Sh startup. ShOr./Startup. Sh

1.4 verify if Apache work well

Http: // host: 8080

If it cannot be accessed, it may be relevantFirewall, Just close firewall usingService iptables stopOrAdd a rule-open 8080

2. Install Jenkins

There are 2 ways to install it, one is using RPM (referto http://jenkins-ci.org/centos), another is using Jenkins. War

2.1 For first method: http://pkg.jenkins-ci.org/redhat/ this will installed Jenkins in/var/lib/Jenkins and the service will in/etc/init. d/Jenkins

When starting Jenkins, there is an error saying/usr/bin/Java: no such file or directory

The solution is to make a soft link usingLn-S $ java_home/bin/Java/usr/bin/Java

Use this method, there is some issueWhen integating with selenium (Firefox profile cannot be accessed well and if put profile in/tmp/, selenium will hang on launching Firefox ....).

2.2 for second method: DownloadJenkins. War, And copy it/Opt/Apache-Tomcat-6.0.33/webapps, And restart Apache

Then we can access Jenkins using http: // host: 8080/Jenkins

3. Install Firefox and Xvfb

Yum install Firefox

Yum install Xvfb

When start Xvfb using/Usr/bin/Xvfb: 1-ac-screen 0 1024x768x8There is an issue below:

(Ee) aiglx error: dlopen of/usr/lib64/DRI/swrast_dri.so failed (/usr/lib64/DRI/swrast_dri.so: cannot open shared object file: no such file or directory)
(Ee) Glx: cocould not load software Renderer

The solution is to installMesa-dri-drivers-7.7-2.el6.x86_64.rpm

4. Set environment variable display

Display =: 1.0(Same with Xvfb starting setting)

5. Install font libs

If we start an app like Firefox, there will an error like (Firefox: 3087): pango-warning **: failed to choose a font, please CT ugly output.

The solution is to install font libs usingYum install xorg-x11-font *

6. Install selenium plugins

Jenkins-manage Jenkins-available-check selenium plugins: Hudson seleniumhq plugin and selenium HTML report to install

7. Download selenium server jar, and put it in/opt/

8. Configure selenium server path

Jenkins-manage Jenkins-configure system

9. configure a job

Note: Firefox need a profile template to launch, the template can be copied from other machine.

How to create a profile template? Just close Firefox browser, and typeFirefox-profilemanagerIn terminal, then the dialog pops up, And we can create it here.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.