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 1
1
/vendor /
2
- .idea /
2
+ .idea /
3
+ nohup.out
Original file line number Diff line number Diff line change 1
1
# 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
6
6
[[ $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
7
7
done
8
8
DIR=" $( cd -P " $( dirname " $SOURCE " ) " && pwd ) "
9
+ cd $DIR
9
10
10
11
echo ' ' > nohup.out
11
- nohup $DIR /selenium-run.bash " $@ " &
12
- sleep 1
12
+ nohup . /selenium-run.bash " $@ " &
13
+ sleep 2
13
14
14
15
cat nohup.out
15
16
echo "
Original file line number Diff line number Diff line change 1
1
#! /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
+
2
11
SOURCE=" ${BASH_SOURCE[0]} "
3
12
while [ -h " $SOURCE " ]; do # resolve $SOURCE until the file is no longer a symlink
4
13
DIR=" $( cd -P " $( dirname " $SOURCE " ) " && pwd ) "
12
21
echo " Failed cd-ing into the the binaries folder, aborting"
13
22
exit 1
14
23
fi
15
- MAJOR_VERSION=2.44
16
- VERSION=${MAJOR_VERSION} .0
17
- JAR_FILE=selenium-server-standalone-${VERSION} .jar
18
24
19
- CHROMEDRIVER_VERSION=2.14
20
- CHROMEDRIVER_FILE=chromedriver-${CHROMEDRIVER_VERSION}
21
25
22
26
# # Host File bug sanity check
23
27
grep ' 127.0.0.1 localhost' /etc/hosts > /dev/null
77
81
78
82
echo " Starting Selenium"
79
83
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
91
86
92
87
93
88
if [[ " $@ " =~ .* firefox.* ]]
Original file line number Diff line number Diff line change 1
1
#! /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
9
12
echo " done"
13
+ else
14
+ echo " No Selenium process found"
10
15
fi
You can’t perform that action at this time.
0 commit comments