Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit bb24367

Browse files
committed
docs(browser-setup): clarifications and style updates
1 parent cdd43cd commit bb24367

File tree

1 file changed

+67
-66
lines changed

1 file changed

+67
-66
lines changed

docs/browser-setup.md

Lines changed: 67 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
Setting up your Browser
1+
Setting Up Your Browser
22
=======================
33

4-
Protractor is agnostic to how you set up your browser - it wraps WebDriverJS, so all browser setup for WebDriverJS applies. This doc serves as a collection for information surrounding how to set up browsers.
4+
Protractor works with [Selenium WebDriver](http://docs.seleniumhq.org/docs/03_webdriver.jsp), a browser automation framework. Selenium WebDriver supports several browser implementations or [drivers](http://docs.seleniumhq.org/docs/03_webdriver.jsp#selenium-webdriver-s-drivers) which are discussed below.
55

66
Browser Support
77
---------------
8-
Protractor uses WebDriver, so Protractor support for a particular browser is tied to the capabilities available in the Driver for that browser. Notably, Protractor requires the driver to implement asynchronous script execution.
8+
Protractor support for a particular browser is tied to the capabilities available in the driver for that browser. Notably, Protractor requires the driver to implement asynchronous script execution.
99

1010
Protractor supports the two latest major versions of Chrome, Firefox, Safari, and IE.
1111

@@ -26,27 +26,28 @@ Protractor supports the two latest major versions of Chrome, Firefox, Safari, an
2626
Configuring Browsers
2727
--------------------
2828

29-
In your Protractor configuration file, all browser set up is done within the `capabilities` JSON object. This is passed directly to the WebDriver Builder.
29+
In your Protractor config file (see [referenceConf.js](/docs/referenceConf.js)), all browser setup is done within the `capabilities` object. This object is passed directly to the WebDriver builder ([builder.js](https://code.google.com/p/selenium/source/browse/javascript/webdriver/builder.js)).
3030

31-
See [the DesiredCapabilities Docs](https://code.google.com/p/selenium/wiki/DesiredCapabilities) for full information on which properties are available.
3231

33-
Switching to a browser besides Chrome
34-
-------------------------------------
32+
See [DesiredCapabilities](https://code.google.com/p/selenium/wiki/DesiredCapabilities) for full information on which properties are available.
33+
34+
Using Browsers Other Than Chrome
35+
--------------------------------
3536

36-
Simply set a different browser name in the capabilites object
37+
To use a browser other than Chrome, simply set a different browser name in the capabilities object.
3738

3839
```javascript
3940
capabilities: {
4041
'browserName': 'firefox'
4142
}
4243
```
4344

44-
You may need to install a separate binary to run another browser, such as IE or Android.
45+
You may need to install a separate binary to run another browser, such as IE or Android. For more information, see [SeleniumHQ Downloads](http://docs.seleniumhq.org/download/).
4546

46-
Adding Chrome specific options
47+
Adding Chrome-Specific Options
4748
------------------------------
4849

49-
Chrome options are nested in the `chromeOptions` object. A full list of options is at [the chromedriver site](https://sites.google.com/a/chromium.org/chromedriver/capabilities). For example, to show an FPS counter in the upper right, your configuration would look like this:
50+
Chrome options are nested in the `chromeOptions` object. A full list of options is at the [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/capabilities) site. For example, to show an FPS counter in the upper right, your configuration would look like this:
5051

5152
```javascript
5253
capabilities: {
@@ -56,12 +57,12 @@ capabilities: {
5657
}
5758
},
5859
```
59-
If running with chromeOnly and chromeOptions together, chromeOptions.args and chromeOptions.extensions are required due to [Issue 6627](https://code.google.com/p/selenium/issues/detail?id=6627&thanks=6627&ts=1385488060) of selenium-webdriver currently(@2.37.0). So in order to avoid the issue, you may simply set them(or one of them) to an empty array.
60+
If running with `chromeOnly` and `chromeOptions` together, chromeOptions.args and chromeOptions.extensions are required due to [Issue 6627](https://code.google.com/p/selenium/issues/detail?id=6627&thanks=6627&ts=1385488060) of selenium-webdriver currently(@2.37.0). So in order to avoid the issue, you may simply set them(or one of them) to an empty array.
6061

61-
Testing against multiple browsers
62+
Testing Against Multiple Browsers
6263
---------------------------------
6364

64-
If you would like to test against multiple browsers at once, use the multiCapabilities configuration option.
65+
If you would like to test against multiple browsers, use the `multiCapabilities` configuration option.
6566

6667
```javascript
6768
multiCapabilities: [{
@@ -71,15 +72,15 @@ multiCapabilities: [{
7172
}]
7273
```
7374

74-
Protractor will run tests in parallel against each set of capabilities. Please note that if multiCapabilities is defined, the runner will ignore the `capabilities` configuration.
75+
Protractor will run tests in parallel against each set of capabilities. Please note that if `multiCapabilities` is defined, the runner will ignore the `capabilities` configuration.
7576

7677

77-
How to set up Protractor with Appium - Android/Chrome
78+
Setting Up Protractor with Appium - Android/Chrome
7879
-------------------------------------
79-
###### Set up
80+
###### Setup
8081
* Install Java SDK (>1.6) and configure JAVA_HOME (Important: make sure it's not pointing to JRE).
81-
* Follow http://spring.io/guides/gs/android/ to install and set up Android developer environment. Do not set up Android Virtual Device as instructed here
82-
* From commandline, ```android avd``` and then install an AVD, taking note of the following
82+
* Follow http://spring.io/guides/gs/android/ to install and set up Android developer environment. Do not set up Android Virtual Device as instructed here.
83+
* From commandline, ```android avd``` and then install an AVD, taking note of the following:
8384
* Start with an ARM ABI
8485
* Enable hardware keyboard: ```hw.keyboard=yes```
8586
* Enable hardware battery: ```hw.battery=yes```
@@ -109,24 +110,24 @@ Available Android Virtual Devices:
109110
Tag/ABI: default/armeabi-v7a
110111
Skin: WXGA800-7in
111112
```
112-
* Follow http://ant.apache.org/manual/index.html to install ant and set up the environment
113+
* Follow http://ant.apache.org/manual/index.html to install ant and set up the environment.
113114
* Follow http://maven.apache.org/download.cgi to install mvn (Maven) and set up the environment.
114-
* NOTE: Appium suggests installing Maven 3.0.5 (I haven't tried later versions, but 3.0.5 works for sure)
115-
* Install Appium using node ```npm install -g appium```. Make sure you don't install as sudo or else Appium will complain
116-
* You can do this either if you installed node without sudo, or you can chown the global node_modules lib and bin directories
117-
* Start emulator manually (at least the first time) and unlock screen
115+
* NOTE: Appium suggests installing Maven 3.0.5 (I haven't tried later versions, but 3.0.5 works for sure).
116+
* Install Appium using node ```npm install -g appium```. Make sure you don't install as sudo or else Appium will complain.
117+
* You can do this either if you installed node without sudo, or you can chown the global node_modules lib and bin directories.
118+
* Start emulator manually (at least the first time) and unlock screen.
118119

119120
```shell
120121
> emulator -avd LatestAndroid
121122
```
122-
* Your devices should show up under adb now
123+
* Your devices should show up under adb now:
123124

124125
```shell
125126
> adb devices
126127
List of devices attached
127128
emulator-5554 device
128129
```
129-
* If the AVD does not have chrome (and it probably won't if it just created), you need to install it
130+
* If the AVD does not have chrome (and it probably won't if it just created), you need to install it:
130131
* You can get v34.0.1847.114 from http://www.apk4fun.com/apk/1192/
131132
* Once you download the apk, install to your AVD as such:
132133

@@ -135,21 +136,21 @@ emulator-5554 device
135136
2323 KB/s (30024100 bytes in 12.617s)
136137
Success
137138
```
138-
* If you check your AVD now, it should have Chrome
139+
* If you check your AVD now, it should have Chrome.
139140

140-
###### Running test
141-
* Ensure app is running if testing local app (Skip if testing public website)
141+
###### Running Tests
142+
* Ensure app is running if testing local app (Skip if testing public website):
142143

143144
```shell
144145
> ./scripts/web-server.js
145146
Starting express web server in /workspace/protractor/testapp on port 8000
146147
```
147-
* If your AVD isn't already started from the setup, start it now
148+
* If your AVD isn't already started from the setup, start it now:
148149

149150
```shell
150151
> emulator -avd LatestAndroid
151152
```
152-
* Start Appium
153+
* Start Appium:
153154

154155
```shell
155156
> appium
@@ -159,7 +160,7 @@ info: socket.io started
159160
```
160161
*Note Appium listens to port 4723 instead of 4444*
161162

162-
* Configure protractor, i.e.
163+
* Configure protractor:
163164

164165
```javascript
165166
exports.config = {
@@ -181,39 +182,39 @@ exports.config = {
181182
baseUrl: 'http://10.0.2.2:' + (process.env.HTTP_PORT || '8000'),
182183
};
183184
```
184-
*note three things:*
185-
-under capabilities: browserName is '', device is 'android', and app is 'chrome'
186-
-baseUrl is 10.0.2.2 instead of localhost because it is used to access the localhost of the host machine in the android emulator
187-
-selenium address is using port 4723
185+
*Note the following:*
186+
- under capabilities: browserName is '', device is 'android', and app is 'chrome'
187+
- baseUrl is 10.0.2.2 instead of localhost because it is used to access the localhost of the host machine in the android emulator
188+
- selenium address is using port 4723
188189

189-
How to set up Protractor with Appium - iOS/Safari
190+
Setting Up Protractor with Appium - iOS/Safari
190191
-------------------------------------
191-
###### Set up
192+
###### Setup
192193
* Install Java SDK (>1.6) and configure JAVA_HOME (Important: make sure it's not pointing to JRE).
193-
* Follow http://ant.apache.org/manual/index.html to install ant and set up the environment
194+
* Follow http://ant.apache.org/manual/index.html to install ant and set up the environment.
194195
* Follow http://maven.apache.org/download.cgi to install mvn (Maven) and set up the environment.
195-
* NOTE: Appium suggests installing Maven 3.0.5 (I haven't tried later versions, but 3.0.5 works for sure)
196-
* Install Appium using node ```npm install -g appium```. Make sure you don't install as sudo or else Appium will complain
197-
* You can do this either if you installed node without sudo, or you can chown the global node_modules lib and bin directories
196+
* NOTE: Appium suggests installing Maven 3.0.5 (I haven't tried later versions, but 3.0.5 works for sure).
197+
* Install Appium using node ```npm install -g appium```. Make sure you don't install as sudo or else Appium will complain.
198+
* You can do this either if you installed node without sudo, or you can chown the global node_modules lib and bin directories.
198199

199-
###### Running test
200-
* Ensure app is running if testing local app (Skip if testing public website)
200+
###### Running Tests
201+
* Ensure app is running if testing local app (Skip if testing public website):
201202

202203
```shell
203204
> ./scripts/web-server.js
204205
Starting express web server in /workspace/protractor/testapp on port 8000
205206
```
206-
* Start Appium
207+
* Start Appium:
207208

208209
```shell
209210
> appium
210211
info: Welcome to Appium v1.0.0-beta.1 (REV 6fcf54391fb06bb5fb03dfcf1582c84a1d9838b6)
211212
info: Appium REST http interface listener started on 0.0.0.0:4723
212213
info: socket.io started
213214
```
214-
*Note Appium listens to port 4723 instead of 4444*
215+
*Note: Appium listens to port 4723 instead of 4444.*
215216

216-
* Configure protractor, i.e.
217+
* Configure protractor:
217218

218219
iPhone:
219220
```javascript
@@ -258,17 +259,17 @@ exports.config = {
258259
};
259260

260261
```
261-
*note three things:*
262-
-note capabilities
263-
-baseUrl is localhost (not 10.0.2.2)
264-
-selenium address is using port 4723
262+
*Note the following:*
263+
- note capabilities
264+
- baseUrl is localhost (not 10.0.2.2)
265+
- selenium address is using port 4723
265266

266-
How to set up Protractor with Selendroid
267+
Setting Up Protractor with Selendroid
267268
-------------------------------------
268-
###### Set up
269+
###### Setup
269270
* Install Java SDK (>1.6) and configure JAVA_HOME (Important: make sure it's not pointing to JRE).
270-
* Follow http://spring.io/guides/gs/android/ to install and set up Android developer environment. Do not set up Android Virtual Device as instructed here
271-
* from commandline, 'android avd' and then follow Selendroid's recommendation (http://selendroid.io/setup.html#androidDevices). Take note of the emulator accelerator. Here's an example:
271+
* Follow http://spring.io/guides/gs/android/ to install and set up Android developer environment. Do not set up Android Virtual Device as instructed here.
272+
* From commandline, 'android avd' and then follow Selendroid's recommendation (http://selendroid.io/setup.html#androidDevices). Take note of the emulator accelerator. Here's an example:
272273

273274
```shell
274275
> android list avd
@@ -281,36 +282,36 @@ Available Android Virtual Devices:
281282
Skin: WVGA800
282283
```
283284

284-
###### Running test
285-
* Ensure app is running if testing local app (Skip if testing public website)
285+
###### Running Tests
286+
* Ensure app is running if testing local app (Skip if testing public website):
286287

287288
```shell
288289
> ./scripts/web-server.js
289290
Starting express web server in /workspace/protractor/testapp on port 8000
290291
```
291292

292-
* Start emulator manually (at least the first time)
293+
* Start emulator manually (at least the first time):
293294

294295
```shell
295296
> emulator -avd myAvd
296297
HAX is working and emulator runs in fast virt mode
297298
```
298299

299-
*note the last line that tells you the emulator accelerator is running*
300+
*Note: The last line that tells you the emulator accelerator is running.*
300301
* Start selendroid
301302

302303
```shell
303304
> java -jar selendroid-standalone-0.9.0-with-dependencies.jar
304305
...
305306
```
306307

307-
* Once selendroid is started, you should be able to go to "http://localhost:4444/wd/hub/status" and see your device there, i.e.
308+
* Once selendroid is started, you should be able to go to "http://localhost:4444/wd/hub/status" and see your device there:
308309

309310
```javascript
310311
{"value":{"os":{"name":"Mac OS X","arch":"x86_64","version":"10.9.2"},"build":{"browserName":"selendroid","version":"0.9.0"},"supportedDevices":[{"emulator":true,"screenSize":"WVGA800","avdName":"Hank","androidTarget":"ANDROID19"}],"supportedApps":[{"mainActivity":"io.selendroid.androiddriver.WebViewActivity","appId":"io.selendroid.androiddriver:0.9.0","basePackage":"io.selendroid.androiddriver"}]},"status":0}
311312
```
312313

313-
* Configure protractor, i.e.
314+
* Configure protractor:
314315

315316
```javascript
316317
exports.config = {
@@ -330,13 +331,13 @@ exports.config = {
330331
};
331332
```
332333

333-
*note two things:*
334-
-browserName is 'android'
335-
-baseUrl is 10.0.2.2 instead of localhost because it is used to access the localhost of the host machine in the android emulator
334+
*Note the following:*
335+
- browserName is 'android'
336+
- baseUrl is 10.0.2.2 instead of localhost because it is used to access the localhost of the host machine in the android emulator
336337

337338

338-
PhantomJS
339-
-------------------------------------
339+
Setting up PhantomJS
340+
--------------------
340341
In order to test locally with [PhantomJS](http://phantomjs.org/), you'll need to either have it installed globally, or relative to your project. For global install see the [PhantomJS download page](http://phantomjs.org/download.html). For relative install run: `npm install --save-dev phantomjs`.
341342

342343
Add phantomjs to the driver capabilities, and include a path to the binary if using local installation:

0 commit comments

Comments
 (0)