File tree Expand file tree Collapse file tree 5 files changed +70
-27
lines changed Expand file tree Collapse file tree 5 files changed +70
-27
lines changed Original file line number Diff line number Diff line change 11/vendor /
2- .idea /
2+ .idea /
3+ nohup.out
Original file line number Diff line number Diff line change 11# selenium-server
2- selenium-server
2+
3+ This is a simple package to easily run Selenium with Chrome driver.
4+
5+ It does not contain the binaries, instead it will download them on first run.
6+
7+ It has only been run and tested on Linux.
8+
9+ To install it simply add
10+
11+ ` "edmondscommerce/selenium-server": "~1" `
12+
13+ To your composer.json file and then run composer update
14+
15+
16+ ## Running
17+
18+ ` bin/selenium-run.bash ` To run Selenium in a terminal. You can stop the Selenium process as required by hitting [ ctrl] +[ c]
19+
20+ ## Running in the background
21+
22+ ` bin/selenium-background-run.bash `
23+
24+ This will run the process in the background using nohup
25+
26+ ## Stopping the background process
27+
28+ ` bin/selenium-stop.bash `
29+
30+ This will find a Selenium process that is running in the background and kill it
31+
32+
33+ ## Firefox / Chrome
34+
35+ This process uses Chrome by default.
36+
37+ If you want to use it with Firefox, you need to append the ` firefox ` flag, eg
38+
39+ ` bin/selenium-run.bash firefox `
40+
41+ Or
42+
43+ ` bin/selenium-background-run.bash firefox `
Original file line number Diff line number Diff line change @@ -6,10 +6,11 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
66 [[ $SOURCE != /* ]] && SOURCE=" $DIR /$SOURCE " # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
77done
88DIR=" $( cd -P " $( dirname " $SOURCE " ) " && pwd ) "
9+ cd $DIR
910
1011echo ' ' > nohup.out
11- nohup $DIR /selenium-run.bash " $@ " &
12- sleep 1
12+ nohup . /selenium-run.bash " $@ " &
13+ sleep 2
1314
1415cat nohup.out
1516echo "
Original file line number Diff line number Diff line change 11#! /bin/bash
2+ # set -x
3+
4+ MAJOR_VERSION=2.44
5+ VERSION=${MAJOR_VERSION} .0
6+ JAR_FILE=selenium-server-standalone-${VERSION} .jar
7+
8+ CHROMEDRIVER_VERSION=2.14
9+ CHROMEDRIVER_FILE=chromedriver-${CHROMEDRIVER_VERSION}
10+
211SOURCE=" ${BASH_SOURCE[0]} "
312while [ -h " $SOURCE " ]; do # resolve $SOURCE until the file is no longer a symlink
413 DIR=" $( cd -P " $( dirname " $SOURCE " ) " && pwd ) "
1221 echo " Failed cd-ing into the the binaries folder, aborting"
1322 exit 1
1423fi
15- MAJOR_VERSION=2.44
16- VERSION=${MAJOR_VERSION} .0
17- JAR_FILE=selenium-server-standalone-${VERSION} .jar
1824
19- CHROMEDRIVER_VERSION=2.14
20- CHROMEDRIVER_FILE=chromedriver-${CHROMEDRIVER_VERSION}
2125
2226# # Host File bug sanity check
2327grep ' 127.0.0.1 localhost' /etc/hosts > /dev/null
7781
7882echo " Starting Selenium"
7983
80- echo " Checking if already running:"
81- h=$( pgrep -f selenium-server)
82- if [[ -n $h ]]; then
83- echo " found running instance, killing that now"
84- kill $h
85- while [[ -n $h ]]; do
86- sleep 1
87- h=$( pgrep -f selenium-server)
88- done
89- fi
90- echo " done"
84+ echo " Killing if already running:"
85+ source $DIR /selenium-stop.bash
9186
9287
9388if [[ " $@ " =~ .* firefox.* ]]
Original file line number Diff line number Diff line change 11#! /bin/bash
2- SELENIUM_PID=$( pgrep -f selenium-server)
3- if [[ " " == " $SELENIUM_PID " ]]
4- then
5- echo " No Selenium process found"
6- else
7- echo " Killing PID $SELENIUM_PID "
8- kill $SELENIUM_PID
2+ SELENIUM_PROCESS_GREP=selenium-server-standalone
3+
4+ h=$( pgrep -f ${SELENIUM_PROCESS_GREP} )
5+ if [[ -n $h ]]; then
6+ echo " Killing PID $h "
7+ kill $h
8+ while [[ -n $h ]]; do
9+ sleep 1
10+ h=$( pgrep -f ${SELENIUM_PROCESS_GREP} )
11+ done
912 echo " done"
13+ else
14+ echo " No Selenium process found"
1015fi
You can’t perform that action at this time.
0 commit comments