Protrator 官网和下载工具稍慢 , 但能使用. Angular CLI 内置 官方推荐 TS的 demo 不明显 , 而且依赖无法安装


C:\Users\pc>cnpm install -g protractor
Downloading protractor to C:\Users\pc\AppData\Roaming\npm\node_modules\protractor_tmp
Copying C:\Users\pc\AppData\Roaming\npm\node_modules\protractor_tmp\_protractor@5.2.0@protractor to C:\Users\pc\AppData\Roaming\npm\node_modules\protractor
Installing protractor's dependencies to C:\Users\pc\AppData\Roaming\npm\node_modules\protractor/node_modules
[1/15] q@1.4.1 installed at node_modules\_q@1.4.1@q
[2/15] jasminewd2@^2.1.0 installed at node_modules\_jasminewd2@2.2.0@jasminewd2
[3/15] @types/q@^0.0.32 installed at node_modules\_@types_q@0.0.32@@types\q
[4/15] optimist@~0.6.0 installed at node_modules\_optimist@0.6.1@optimist
[5/15] @types/node@^6.0.46 installed at node_modules\_@types_node@6.0.92@@types\node
[6/15] chalk@^1.1.3 installed at node_modules\_chalk@1.1.3@chalk
[7/15] blocking-proxy@0.0.5 installed at node_modules\_blocking-proxy@0.0.5@blocking-proxy
[8/15] @types/selenium-webdriver@~2.53.39 installed at node_modules\_@types_selenium-webdriver@2.53.43@@types\selenium-webdriver
[9/15] jasmine@^2.5.3 installed at node_modules\_jasmine@2.8.0@jasmine
[10/15] glob@^7.0.3 installed at node_modules\_glob@7.1.2@glob
[11/15] saucelabs@~1.3.0 installed at node_modules\_saucelabs@1.3.0@saucelabs
[12/15] source-map-support@~0.4.0 installed at node_modules\_source-map-support@0.4.18@source-map-support
[13/15] webdriver-manager@^12.0.6 installed at node_modules\_webdriver-manager@12.0.6@webdriver-manager
[14/15] selenium-webdriver@3.6.0 installed at node_modules\_selenium-webdriver@3.6.0@selenium-webdriver
[15/15] webdriver-js-extender@^1.0.0 installed at node_modules\_webdriver-js-extender@1.0.0@webdriver-js-extender
Recently updated (since 2017-11-27): 3 packages (detail see file C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\node_modules\.recently_updates.txt)
2017-12-02
→ webdriver-manager@12.0.6 › request@2.83.0 › har-validator@5.0.3 › ajv@^5.1.0(5.5.1) (20:48:13)
2017-12-01
→ webdriver-manager@12.0.6 › request@2.83.0 › http-signature@1.2.0 › jsprim@1.4.1 › verror@1.10.0 › extsprintf@^1.2.0(1.4.0) (05:26:44)
2017-11-30
→ webdriver-manager@12.0.6 › del@2.2.2 › is-path-in-cwd@1.0.0 › is-path-inside@^1.0.0(1.0.1) (18:34:52)
All packages installed (137 packages installed from npm registry, used 27s, speed 210.86kB/s, json 127(254.64kB), tarball 5.29MB)
[protractor@5.2.0] link C:\Users\pc\AppData\Roaming\npm\protractor@ -> C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\bin\protractor
[protractor@5.2.0] link C:\Users\pc\AppData\Roaming\npm\webdriver-manager@ -> C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\bin\webdriver-manager
C:\Users\pc>cnpm install -g protractor
Downloading protractor to C:\Users\pc\AppData\Roaming\npm\node_modules\protractor_tmp
Copying C:\Users\pc\AppData\Roaming\npm\node_modules\protractor_tmp\_protractor@5.2.0@protractor to C:\Users\pc\AppData\Roaming\npm\node_modules\protractor
Installing protractor's dependencies to C:\Users\pc\AppData\Roaming\npm\node_modules\protractor/node_modules
[1/15] q@1.4.1 installed at node_modules\_q@1.4.1@q
[2/15] jasminewd2@^2.1.0 installed at node_modules\_jasminewd2@2.2.0@jasminewd2
[3/15] @types/q@^0.0.32 installed at node_modules\_@types_q@0.0.32@@types\q
[4/15] optimist@~0.6.0 installed at node_modules\_optimist@0.6.1@optimist
[5/15] @types/node@^6.0.46 installed at node_modules\_@types_node@6.0.92@@types\node
[6/15] chalk@^1.1.3 installed at node_modules\_chalk@1.1.3@chalk
[7/15] blocking-proxy@0.0.5 installed at node_modules\_blocking-proxy@0.0.5@blocking-proxy
[8/15] @types/selenium-webdriver@~2.53.39 installed at node_modules\_@types_selenium-webdriver@2.53.43@@types\selenium-webdriver
[9/15] jasmine@^2.5.3 installed at node_modules\_jasmine@2.8.0@jasmine
[10/15] glob@^7.0.3 installed at node_modules\_glob@7.1.2@glob
[11/15] saucelabs@~1.3.0 installed at node_modules\_saucelabs@1.3.0@saucelabs
[12/15] source-map-support@~0.4.0 installed at node_modules\_source-map-support@0.4.18@source-map-support
[13/15] webdriver-manager@^12.0.6 installed at node_modules\_webdriver-manager@12.0.6@webdriver-manager
[14/15] selenium-webdriver@3.6.0 installed at node_modules\_selenium-webdriver@3.6.0@selenium-webdriver
[15/15] webdriver-js-extender@^1.0.0 installed at node_modules\_webdriver-js-extender@1.0.0@webdriver-js-extender
Recently updated (since 2017-11-27): 3 packages (detail see file C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\node_modules\.recently_updates.txt)
2017-12-02
→ webdriver-manager@12.0.6 › request@2.83.0 › har-validator@5.0.3 › ajv@^5.1.0(5.5.1) (20:48:13)
2017-12-01
→ webdriver-manager@12.0.6 › request@2.83.0 › http-signature@1.2.0 › jsprim@1.4.1 › verror@1.10.0 › extsprintf@^1.2.0(1.4.0) (05:26:44)
2017-11-30
→ webdriver-manager@12.0.6 › del@2.2.2 › is-path-in-cwd@1.0.0 › is-path-inside@^1.0.0(1.0.1) (18:34:52)
All packages installed (137 packages installed from npm registry, used 27s, speed 210.86kB/s, json 127(254.64kB), tarball 5.29MB)
[protractor@5.2.0] link C:\Users\pc\AppData\Roaming\npm\protractor@ -> C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\bin\protractor
[protractor@5.2.0] link C:\Users\pc\AppData\Roaming\npm\webdriver-manager@ -> C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\bin\webdriver-manager
C:\Users\pc>webdriver-manager update
[09:44:21] I/update - geckodriver: file exists C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\node_modules\_webdriver-manager@12.0.6@webdriver-manager\selenium\geckodriver-v0.19.1.zip
[09:44:21] I/update - geckodriver: unzipping geckodriver-v0.19.1.zip
[09:44:21] I/update - geckodriver: geckodriver-v0.19.1.exe up to date
events.js:183
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at _errnoException (util.js:1024:11)
at TLSWrap.onread (net.js:615:25)
C:\Users\pc>webdriver-manager update
[09:44:21] I/update - geckodriver: file exists C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\node_modules\_webdriver-manager@12.0.6@webdriver-manager\selenium\geckodriver-v0.19.1.zip
[09:44:21] I/update - geckodriver: unzipping geckodriver-v0.19.1.zip
[09:44:21] I/update - geckodriver: geckodriver-v0.19.1.exe up to date
events.js:183
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at _errnoException (util.js:1024:11)
at TLSWrap.onread (net.js:615:25)


之前网络不好 , 连驱动都需要下载很多次才成功
有时候挂机一个晚上驱动也不行 , 最终会报错 , 说网络超时
现在可以了
果然是网络的问题, 有时候会抽筋
之前网络不好 , 连驱动都需要下载很多次才成功
有时候挂机一个晚上驱动也不行 , 最终会报错 , 说网络超时
现在可以了
果然是网络的问题, 有时候会抽筋
# 安装驱动
C:\Users\pc>webdriver-manager update
[09:31:56] I/update - chromedriver: file exists C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.33.zip
[09:31:56] I/update - chromedriver: unzipping chromedriver_2.33.zip
[09:31:56] I/update - chromedriver: chromedriver_2.33.exe up to date
[09:32:22] E/downloader - Connection timeout downloading: https://github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-win64.zip. Default timeout is 4 minutes.
[09:32:22] I/update - geckodriver: file exists C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\geckodriver-v0.19.1.zip
[09:32:22] I/update - geckodriver: unzipping geckodriver-v0.19.1.zip
(node:27460) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Invalid or unsupported zip format. No END header found
(node:27460) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
# 运行
C:\Users\pc>webdriver-manager start
[09:35:52] I/start - java -Dwebdriver.chrome.driver=C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.33.exe -jar C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.8.0.jar -port 4444
[09:35:52] I/start - seleniumProcess.pid: 17572
09:35:52.582 INFO - Selenium build info: version: '3.8.0', revision: '924c4067df'
09:35:52.583 INFO - Launching a standalone Selenium Server
2017-12-01 09:35:52.670:INFO::main: Logging initialized @390ms to org.seleniumhq.jetty9.util.log.StdErrLog
09:35:52.696 INFO - Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
09:35:52.705 INFO - Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
09:35:52.707 INFO - Using `new EdgeOptions()` is preferred to `DesiredCapabilities.edge()`
09:35:52.707 INFO - Driver class not found: com.opera.core.systems.OperaDriver
09:35:52.707 INFO - Using `new OperaOptions()` is preferred to `DesiredCapabilities.operaBlink()`
09:35:52.710 INFO - Using `new SafariOptions()` is preferred to `DesiredCapabilities.safari()`
09:35:52.712 INFO - Driver class not found: org.openqa.selenium.phantomjs.PhantomJSDriver
09:35:52.741 INFO - Driver provider class org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities {browserName: safari, platform: MAC, version: } does not match the current platform WIN10
09:35:52.772 INFO - Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
09:35:52.773 INFO - Using `new EdgeOptions()` is preferred to `DesiredCapabilities.edge()`
09:35:52.777 INFO - Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
09:35:52.781 INFO - Using `new OperaOptions()` is preferred to `DesiredCapabilities.operaBlink()`
09:35:52.783 INFO - Using `new SafariOptions()` is preferred to `DesiredCapabilities.safari()`
09:35:52.791 INFO - Using the passthrough mode handler
2017-12-01 09:35:52.809:INFO:osjs.Server:main: jetty-9.4.7.v20170914
2017-12-01 09:35:52.825:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.ServletContextHandler@2db7a79b{/,null,STARTING} has uncovered http methods for path: /
2017-12-01 09:35:52.829:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@2db7a79b{/,null,AVAILABLE}2017-12-01 09:35:52.862:INFO:osjs.AbstractConnector:main: Started ServerConnector@652d2fa2{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-12-01 09:35:52.868:INFO:osjs.Server:main: Started @588ms
09:35:52.871 INFO - Selenium Server is up and running
# 安装驱动
C:\Users\pc>webdriver-manager update
[09:31:56] I/update - chromedriver: file exists C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.33.zip
[09:31:56] I/update - chromedriver: unzipping chromedriver_2.33.zip
[09:31:56] I/update - chromedriver: chromedriver_2.33.exe up to date
[09:32:22] E/downloader - Connection timeout downloading: https://github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-win64.zip. Default timeout is 4 minutes.
[09:32:22] I/update - geckodriver: file exists C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\geckodriver-v0.19.1.zip
[09:32:22] I/update - geckodriver: unzipping geckodriver-v0.19.1.zip
(node:27460) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Invalid or unsupported zip format. No END header found
(node:27460) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
# 运行
C:\Users\pc>webdriver-manager start
[09:35:52] I/start - java -Dwebdriver.chrome.driver=C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.33.exe -jar C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.8.0.jar -port 4444
[09:35:52] I/start - seleniumProcess.pid: 17572
09:35:52.582 INFO - Selenium build info: version: '3.8.0', revision: '924c4067df'
09:35:52.583 INFO - Launching a standalone Selenium Server
2017-12-01 09:35:52.670:INFO::main: Logging initialized @390ms to org.seleniumhq.jetty9.util.log.StdErrLog
09:35:52.696 INFO - Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
09:35:52.705 INFO - Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
09:35:52.707 INFO - Using `new EdgeOptions()` is preferred to `DesiredCapabilities.edge()`
09:35:52.707 INFO - Driver class not found: com.opera.core.systems.OperaDriver
09:35:52.707 INFO - Using `new OperaOptions()` is preferred to `DesiredCapabilities.operaBlink()`
09:35:52.710 INFO - Using `new SafariOptions()` is preferred to `DesiredCapabilities.safari()`
09:35:52.712 INFO - Driver class not found: org.openqa.selenium.phantomjs.PhantomJSDriver
09:35:52.741 INFO - Driver provider class org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities {browserName: safari, platform: MAC, version: } does not match the current platform WIN10
09:35:52.772 INFO - Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
09:35:52.773 INFO - Using `new EdgeOptions()` is preferred to `DesiredCapabilities.edge()`
09:35:52.777 INFO - Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
09:35:52.781 INFO - Using `new OperaOptions()` is preferred to `DesiredCapabilities.operaBlink()`
09:35:52.783 INFO - Using `new SafariOptions()` is preferred to `DesiredCapabilities.safari()`
09:35:52.791 INFO - Using the passthrough mode handler
2017-12-01 09:35:52.809:INFO:osjs.Server:main: jetty-9.4.7.v20170914
2017-12-01 09:35:52.825:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.ServletContextHandler@2db7a79b{/,null,STARTING} has uncovered http methods for path: /
2017-12-01 09:35:52.829:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@2db7a79b{/,null,AVAILABLE}2017-12-01 09:35:52.862:INFO:osjs.AbstractConnector:main: Started ServerConnector@652d2fa2{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-12-01 09:35:52.868:INFO:osjs.Server:main: Started @588ms
09:35:52.871 INFO - Selenium Server is up and running

todo
Protractor 提供的测试页面 , 计算器
http://juliemr.github.io/protractor-demo/
控制台正常 , 只是 有个图标没有加载到 , 没关系
面向页面的试试
http://blog.csdn.net/github_39212680/article/details/73433870
写得很详细
http://www.protractortest.org/#/
文档
http://www.protractortest.org/#/typescript
例子
https://github.com/angular/protractor/tree/5.2.0/exampleTypescript
简介
官网
http://www.protractortest.org/
github
https://github.com/angular/protractor
官网稍慢 , 但能打得开 Angular CLI 内置 官方推荐
可用于 AngularJS 和 Angular 的 端到端 web 自动化测试
可以根据 模型 和 bind 来找元素很方便
E2E test framework for Angular apps
Protractor is an end-to-end test framework for Angular and AngularJS applications.
Protractor is a Node.js program built on top of WebDriverJS.
安装
在国内很可能安装失败 , 所以我建议用阿里提供的 cnpm 工具
npm install -g cnpm
后面的操作 , 用到 npm install 的命令都建议用 cnpm install 替代 , 就是最前面加个 c 字母
npm install -g protractor
会自动安装两个工具:protractor 和 webdriver-manager
看是否安装成功,成功的话 : {
先确认 protractor , 命令行里执行 :
protractor
**you must either specify a configuration file or at least 3 options. See below for the options:
Usage: protractor [configFile] [options]
configFile defaults to protractor.conf.js
The [options] object will override values from the config file.
See the reference config for a full list of options.
Options:
--help Print Protractor help menu
( 以下省略 )
其次确认 webdriver-manager , 命令行里执行 :
webdriver-manager
Usage: webdriver-manager <command> [options]
Commands:
clean removes all downloaded driver files from the out_dir
start start up the selenium server
shutdown shut down the selenium server
status list the current available drivers
update install or update selected binaries
version get the current version
( 以下省略 )
}
更新浏览器驱动
webdriver-manager update
确保本地安装好的谷歌浏览器的版本 是 59 以上
我的当前版本 ( 58.0 ) 太旧 , 要更新 . 不然在运行脚本的时候会提示 Chrome version must be >= 59.0.3071.0 ,
也就是建议升级谷歌浏览器到 59.0 以上
之前的 :
查看谷歌浏览器的版本 , 在URL地址栏输入
chrome://settings/help
在浏览器里自动更新就行 , 不行的话再百度安装包
更新好后 :
版本 : 60.0.3112.113(正式版本) (64 位)
执行测试代码之前要开启服务
webdriver-manager start
学习资料
api 文档
http://www.protractortest.org/#/api
推酷上搜不到
主要是官网
http://www.protractortest.org/
快速入门
http://www.protractortest.org/#/tutorial
总的教程目录
http://www.protractortest.org/#/toc
而且可以用 TypeScript 写
还有调试 自动化测试代码 的技巧
对应的代码
https://github.com/angular/protractor/tree/5.1.2/exampleTypescript
第三方文章
端对端的自动化测试
自动化端对端测试-Protrator Tutorial
https://my.oschina.net/u/658505/blog/665158
http://juliemr.github.io/protractor-demo/
实践 /尝试 自己试一下
国人翻译的
http://www.cnblogs.com/haogj/p/4815673.html
被测试的网站 http://juliemr.github.io/protractor-demo/ , 官方搭建的
安装成功 : 步骤
安装 Protractor 软件
更新 webdriver-manager
在任意位置开服务 , 不是 serve 或者 server
webdriver-manager start
到当前目录
cd /d G:\autoTest\Protractor\First
protractor + 配置文件.js
protractor config.js
config.js 里面配置里要执行 example_spec.js 测试用例文件 , 可以配置多个
脚本启动正常 :
G:\autoTest\Protractor\First>protractor config.js
[10:47:41] I/launcher - Running 1 instances of WebDriver
[10:47:41] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
Started
4
1
G:\autoTest\Protractor\First>protractor config.js
2
[10:47:41] I/launcher - Running 1 instances of WebDriver
3
[10:47:41] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
4
Started
出现Chrome浏览器
脚本自动运行
过段时间自动退出 , 控制台显示报错 , 这个没事
清理 cmd
cls
知识点
beforeEach
每个方法 ( 测试用例 ) 执行前都会执行这个方法 , 很常用的场景 :
beforeEach( function() {
browser.get('http://juliemr.github.io/protractor-demo/');
}
);
每次都打开网址
it 是什么
为什么有两个嵌套的 描述 ?
问题
webdriver-manager update 无法安装
PS C:\Windows\system32> webdriver-manager update
events.js:183
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at _errnoException (util.js:1024:11)
at TLSWrap.onread (net.js:615:25)
C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium
文件夹创建成功
pc>webdriver-manager update
[20:55:45] I/file_manager - creating folder C:\Users\pc\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium
events.js:183
throw er; // Unhandled 'error' event
^
Error: connect ETIMEDOUT 172.217.27.144:443
at Object._errnoException (util.js:1024:11)
at _exceptionWithHostPort (util.js:1046:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
现象 :
{
不安装的话启动服务的时候会提示
根据提示执行命令
webdriver-manager update --standalone
之前是报错
然后是
}
npm uninstall -g protractor
重装
npm install -g protractor
因为需要创建文件夹
需要我用管理员权限打开cmd吗
111
开了蓝灯 , 一直重试
能单独下载到
webdriver-manager start 无法启动服务 , 之前可以
之前可以的
E:\autoTest\Protractor\Protractor-source>webdriver-manager start
[15:56:31] I/start - java -Dwebdriver.chrome.driver=C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.32.exe -jar C:\Users\zhangqiang\AppData\Roaming\np
m\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.5.3.jar -port 4444
[15:56:31] I/start - seleniumProcess.pid: 17148
Error: Unable to access jarfile C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.5.3.jar
[15:56:32] I/start - Selenium Standalone has exited with code 1
6
1
E:\autoTest\Protractor\Protractor-source>webdriver-manager start
2
[15:56:31] I/start - java -Dwebdriver.chrome.driver=C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.32.exe -jar C:\Users\zhangqiang\AppData\Roaming\np
3
m\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.5.3.jar -port 4444
4
[15:56:31] I/start - seleniumProcess.pid: 17148
5
Error: Unable to access jarfile C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.5.3.jar
6
[15:56:32] I/start - Selenium Standalone has exited with code 1
解决方法
重装一下 , webdriver-manager update
因为环境坏了 , 或者不是最新版
服务正常了 : ( 最下面一行没有结束 , 光标会一直闪烁 ) 提示 Selenium Server is up and running
C:\Users\zhangqiang>webdriver-manager start
[10:26:31] I/start - java -Dwebdriver.chrome.driver=C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\_webdriver-manager@12.0.6@webdriver-manager\selenium\chromedriver_2.33.exe -Dwebdriver.gecko.driver=C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\_webdriver-manager@12.0.6@webdriver-manager\selenium\geckodriver-v0.19.0.exe -jar C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\_webdriver-manager@12.0.6@webdriver-manager\selenium\selenium-server-standalone-3.6.0.jar -port 4444
[10:26:31] I/start - seleniumProcess.pid: 82572
10:26:34.618 INFO - Selenium build info: version: '3.6.0', revision: '6fbf3ec767'
10:26:34.632 INFO - Launching a standalone Selenium Server
2017-10-23 10:26:34.765:INFO::main: Logging initialized @2565ms to org.seleniumhq.jetty9.util.log.StdErrLog
10:26:35.042 INFO - Driver class not found: com.opera.core.systems.OperaDriver
10:26:35.396 INFO - Driver provider class org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN8_1
10:26:35.665 INFO - Using the passthrough mode handler
2017-10-23 10:26:35.815:INFO:osjs.Server:main: jetty-9.4.5.v20170502
2017-10-23 10:26:35.993:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.ServletContextHandler@5a8e6209{/,null,STARTING} has uncovered http methods for path: /
2017-10-23 10:26:36.048:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@5a8e6209{/,null,AVAILABLE}
2017-10-23 10:26:36.348:INFO:osjs.AbstractConnector:main: Started ServerConnector@614ddd49{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-10-23 10:26:36.354:INFO:osjs.Server:main: Started @4154ms
10:26:36.361 INFO - Selenium Server is up and running
x
1
C:\Users\zhangqiang>webdriver-manager start
2
[10:26:31] I/start - java -Dwebdriver.chrome.driver=C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\_webdriver-manager@12.0.6@webdriver-manager\selenium\chromedriver_2.33.exe -Dwebdriver.gecko.driver=C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\_webdriver-manager@12.0.6@webdriver-manager\selenium\geckodriver-v0.19.0.exe -jar C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\_webdriver-manager@12.0.6@webdriver-manager\selenium\selenium-server-standalone-3.6.0.jar -port 4444
3
[10:26:31] I/start - seleniumProcess.pid: 82572
4
10:26:34.618 INFO - Selenium build info: version: '3.6.0', revision: '6fbf3ec767'
5
10:26:34.632 INFO - Launching a standalone Selenium Server
6
2017-10-23 10:26:34.765:INFO::main: Logging initialized @2565ms to org.seleniumhq.jetty9.util.log.StdErrLog
7
10:26:35.042 INFO - Driver class not found: com.opera.core.systems.OperaDriver
8
10:26:35.396 INFO - Driver provider class org.openqa.selenium.safari.SafariDriver registration is skipped:
9
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN8_1
10
10:26:35.665 INFO - Using the passthrough mode handler
11
2017-10-23 10:26:35.815:INFO:osjs.Server:main: jetty-9.4.5.v20170502
12
2017-10-23 10:26:35.993:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.ServletContextHandler@5a8e6209{/,null,STARTING} has uncovered http methods for path: /
13
2017-10-23 10:26:36.048:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@5a8e6209{/,null,AVAILABLE}
14
2017-10-23 10:26:36.348:INFO:osjs.AbstractConnector:main: Started ServerConnector@614ddd49{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
15
2017-10-23 10:26:36.354:INFO:osjs.Server:main: Started @4154ms
16
10:26:36.361 INFO - Selenium Server is up and running
17
脚本也启动正常
ReferenceError: browser is not defined
要先启动服务 webdriver-manager start
然后就正常了
备注
自动化测试代码执行期间 , 可以做别的事情 , 因为是脚本在操作浏览器
不需要在这之前手动启动浏览器 , 但Selenium 代理服务要先启动
Chrome version must be >= 59.0.3071.0
在WebStorm run 服务 , 但不行
重装一次
文件下载到
C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\_webdriver-manager@12.0.6@webdriver-manager\selenium
7个文件
下载好后
解压太慢 , 我手动解压了
再执行一次更新
仍旧是7个文件 , 没有解压的
还是不行 , 需要update
这个一直都下载失败 geckodriver-v0.18.0-win64.zip
I/update - geckodriver: unzipping geckodriver-v0.18.0.zip
(node:2200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Invalid filename
报错说文件名有问题 , 所以无法解压 . 但其实是因为 0大小 , 没下载成功 .
自己手动下载 , 然后放到对应的目录里
单击 0 大小的压缩包
成功的 , 用自动下载的
http://localhost:4444/wd/hub/static/resource/hub.html
update 包下载不下来
服务忘了了
本地的谷歌浏览器太久
Protractor 官方在GitHub的 TypeScript 依赖包安装失败
重装试试
其他的正常
run 起来试试
后面有时间再按照你的需求改UI
Protrator 官网和下载工具稍慢 , 但能使用. Angular CLI 内置 官方推荐 TS的 demo 不明显 , 而且依赖无法安装的更多相关文章
- Maven 官网 查找&下载 jar包& pom引用 完美方案
Maven 官网 查找&下载 jar包 & pom引用 问题描述 在我们在开发过程中,经常遇到程序中需要引用的某个版本jar包,但是在公司的私有仓库下载不到的情况. 遇到这种情况,该怎 ...
- 官网app下载更换成微信公众号二维码 测试
微信现在很火啊.公司官网原先提供的ios和andriod的app下载链接要求切换成微信公众号二维码.简单的替换,大家都说不需要测试直接上线.还是测了下. 1 验证所有与下载相关的信息都已去除. 包括下 ...
- apache官网怎样下载apache HTTP Server服务器
我相信有些朋友刚用apache服务器时,都希望从官网上下载,而面对着官网上众多的项目和镜像以及目录,也许有点茫然.下面是具体步骤 第一步:打开apache官网 第二步:点击右上角Download,出现 ...
- Spring 官网jar下载
1,首先输入http://spring.io/进入Spring官网 2,点击project 栏,找到Spring framwork 3,点击reference 4,找到Distribution Zip ...
- 分享一个开源的网盘下载工具BaiduPCS-Go
大家在使用网盘的时候,一定忍受不了限速下载的速度.今天给大家分享一个开源的网盘下载项目BaiduPCS-Go.Go语言编写,仿 Linux shell 文件处理命令的百度网盘命令行客户端.多平台支持, ...
- centos官网镜像下载方法
1.CentoS简介 CentOS(Community Enterprise Operating System,社区企业操作系统)是一个基于Red Hat Linux 提供的可自由使用源代码的企业级L ...
- MongoDB 官网教程 下载 安装
官网:https://www.mongodb.com/ Doc:https://docs.mongodb.com/ Manual:https://docs.mongodb.com/manual/ 安装 ...
- 跑满带宽的一款百度网盘下载工具 : PanDownload
下载地址 : 点击进入 官网上面也有介绍使用.在这里,我再说一下 下载之后,解压,运行,登录, 登录好之后,准备进行设置 重要:下载情况分以下三部分 下载内容 < 300M,选择`打包下载`,只 ...
- 如何从oracle官网中下载The java language specification(java 语言规范)
第一步: 第二步: 第三步:下面这个图在这个页面的下方,所以你只要一直往下看,直到看到下图的文字为止: 第四步: 第五步: 这样你就可以成功下载该java 语言规范的pdf了. 它直接下载的网址为: ...
随机推荐
- cenots7单机安装Kubernetes
关于什么是Kubernetes请看另一篇内容:http://www.cnblogs.com/boshen-hzb/p/6482734.html 一.环境搭建 master安装的组件有: docker ...
- 【转载】如何选择MySQL存储引擎
一.MySQL的存储引擎 完整的引擎说明还是看官方文档:http://dev.mysql.com/doc/refman/5.6/en/storage-engines.html 这里介绍一些主要的引擎 ...
- HDU 6007 Mr. Panda and Crystal (背包+spfa)
题意:你生活在一个魔法大陆上,你有n 魔力, 这个大陆上有m 种魔法水晶,还有n 种合成水晶的方式,每种水晶价格告诉你,并且告诉你哪些水晶你能直接造出来,哪些你必须合成才能造出来,问你n魔力最多能卖多 ...
- MongoDBAppender
分三步: 1. client 2. appender 3. 配置文件 logback-test.xml <configuration> <appender name="MO ...
- APUE(4)---文件和目录 (1)
一.引言 上一章执行I/O的基本函数(打开文件.读文件和写文件),本章将描述文件系统的其他特征和文件的性质,我们将从stat函数开始,并逐个说明stat结构的每一个成员以了解文件的所有属性.在此过程中 ...
- Middleware / 中间件
中间件格式 module.exports = options => { return (ctx, next) => { // do something } } 中间件格式为一个高阶函数,外 ...
- ibatis源码学习2_初始化和配置文件解析
问题在详细介绍ibatis初始化过程之前,让我们先来思考几个问题. 1. ibatis初始化的目标是什么?上文中提到过,ibatis初始化的核心目标是构造SqlMapClientImpl对象,主要是其 ...
- linux 挂载和使用文件系统
从分区,到创建文件系统,再到把磁盘或分区挂载到一个目录后才能够使用. Windows或Mac系统会自动进行挂载,一旦创建好文件系统后会自动挂载到系统上,Windows我们称之为C\D盘,而Linux需 ...
- Android-Handler+Message-消息机制
我的理解是,子线程要和主线程通讯,就需要Handler+Message-消息机制 案例一:倒计时Demo(子线程+Handler+Message) package liudeli.async; imp ...
- Oracle 表关联性 Update 语句的改写,推荐改写方法1
同事写了一个逻辑稍复杂的Update 语句,觉得在代码可读性上有些转圈,交给我帮忙改下. 以下根据原SQL,使用两种方法进行改写,个人推荐方法1的改写.方法2拆分两个SQL来写,代码可读性最强,但是S ...





执行测试代码之前要开启服务
学习资料
api 文档
http://www.protractortest.org/#/api
推酷上搜不到
主要是官网
http://www.protractortest.org/
快速入门
http://www.protractortest.org/#/tutorial
总的教程目录
http://www.protractortest.org/#/toc
而且可以用 TypeScript 写
还有调试 自动化测试代码 的技巧
对应的代码
https://github.com/angular/protractor/tree/5.1.2/exampleTypescript
第三方文章
端对端的自动化测试
自动化端对端测试-Protrator Tutorial
https://my.oschina.net/u/658505/blog/665158
http://juliemr.github.io/protractor-demo/


第三方文章
G:\autoTest\Protractor\First>protractor config.js
[10:47:41] I/launcher - Running 1 instances of WebDriver
[10:47:41] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
Started
G:\autoTest\Protractor\First>protractor config.js
[10:47:41] I/launcher - Running 1 instances of WebDriver
[10:47:41] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
Started
每个方法 ( 测试用例 ) 执行前都会执行这个方法 , 很常用的场景 :
问题


根据提示执行命令


npm uninstall -g protractor

webdriver-manager start 无法启动服务 , 之前可以
E:\autoTest\Protractor\Protractor-source>webdriver-manager start
[15:56:31] I/start - java -Dwebdriver.chrome.driver=C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.32.exe -jar C:\Users\zhangqiang\AppData\Roaming\np
m\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.5.3.jar -port 4444
[15:56:31] I/start - seleniumProcess.pid: 17148
Error: Unable to access jarfile C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.5.3.jar
[15:56:32] I/start - Selenium Standalone has exited with code 1
E:\autoTest\Protractor\Protractor-source>webdriver-manager start
[15:56:31] I/start - java -Dwebdriver.chrome.driver=C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.32.exe -jar C:\Users\zhangqiang\AppData\Roaming\np
m\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.5.3.jar -port 4444
[15:56:31] I/start - seleniumProcess.pid: 17148
Error: Unable to access jarfile C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.5.3.jar
[15:56:32] I/start - Selenium Standalone has exited with code 1
C:\Users\zhangqiang>webdriver-manager start
[10:26:31] I/start - java -Dwebdriver.chrome.driver=C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\_webdriver-manager@12.0.6@webdriver-manager\selenium\chromedriver_2.33.exe -Dwebdriver.gecko.driver=C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\_webdriver-manager@12.0.6@webdriver-manager\selenium\geckodriver-v0.19.0.exe -jar C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\_webdriver-manager@12.0.6@webdriver-manager\selenium\selenium-server-standalone-3.6.0.jar -port 4444
[10:26:31] I/start - seleniumProcess.pid: 82572
10:26:34.618 INFO - Selenium build info: version: '3.6.0', revision: '6fbf3ec767'
10:26:34.632 INFO - Launching a standalone Selenium Server
2017-10-23 10:26:34.765:INFO::main: Logging initialized @2565ms to org.seleniumhq.jetty9.util.log.StdErrLog
10:26:35.042 INFO - Driver class not found: com.opera.core.systems.OperaDriver
10:26:35.396 INFO - Driver provider class org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN8_1
10:26:35.665 INFO - Using the passthrough mode handler
2017-10-23 10:26:35.815:INFO:osjs.Server:main: jetty-9.4.5.v20170502
2017-10-23 10:26:35.993:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.ServletContextHandler@5a8e6209{/,null,STARTING} has uncovered http methods for path: /
2017-10-23 10:26:36.048:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@5a8e6209{/,null,AVAILABLE}
2017-10-23 10:26:36.348:INFO:osjs.AbstractConnector:main: Started ServerConnector@614ddd49{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-10-23 10:26:36.354:INFO:osjs.Server:main: Started @4154ms
10:26:36.361 INFO - Selenium Server is up and running
C:\Users\zhangqiang>webdriver-manager start
[10:26:31] I/start - java -Dwebdriver.chrome.driver=C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\_webdriver-manager@12.0.6@webdriver-manager\selenium\chromedriver_2.33.exe -Dwebdriver.gecko.driver=C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\_webdriver-manager@12.0.6@webdriver-manager\selenium\geckodriver-v0.19.0.exe -jar C:\Users\zhangqiang\AppData\Roaming\npm\node_modules\protractor\node_modules\_webdriver-manager@12.0.6@webdriver-manager\selenium\selenium-server-standalone-3.6.0.jar -port 4444
[10:26:31] I/start - seleniumProcess.pid: 82572
10:26:34.618 INFO - Selenium build info: version: '3.6.0', revision: '6fbf3ec767'
10:26:34.632 INFO - Launching a standalone Selenium Server
2017-10-23 10:26:34.765:INFO::main: Logging initialized @2565ms to org.seleniumhq.jetty9.util.log.StdErrLog
10:26:35.042 INFO - Driver class not found: com.opera.core.systems.OperaDriver
10:26:35.396 INFO - Driver provider class org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN8_1
10:26:35.665 INFO - Using the passthrough mode handler
2017-10-23 10:26:35.815:INFO:osjs.Server:main: jetty-9.4.5.v20170502
2017-10-23 10:26:35.993:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.ServletContextHandler@5a8e6209{/,null,STARTING} has uncovered http methods for path: /
2017-10-23 10:26:36.048:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@5a8e6209{/,null,AVAILABLE}
2017-10-23 10:26:36.348:INFO:osjs.AbstractConnector:main: Started ServerConnector@614ddd49{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-10-23 10:26:36.354:INFO:osjs.Server:main: Started @4154ms
10:26:36.361 INFO - Selenium Server is up and running







Protractor 官方在GitHub的 TypeScript 依赖包安装失败
Protrator 官网和下载工具稍慢 , 但能使用. Angular CLI 内置 官方推荐 TS的 demo 不明显 , 而且依赖无法安装的更多相关文章
- Maven 官网 查找&下载 jar包& pom引用 完美方案
Maven 官网 查找&下载 jar包 & pom引用 问题描述 在我们在开发过程中,经常遇到程序中需要引用的某个版本jar包,但是在公司的私有仓库下载不到的情况. 遇到这种情况,该怎 ...
- 官网app下载更换成微信公众号二维码 测试
微信现在很火啊.公司官网原先提供的ios和andriod的app下载链接要求切换成微信公众号二维码.简单的替换,大家都说不需要测试直接上线.还是测了下. 1 验证所有与下载相关的信息都已去除. 包括下 ...
- apache官网怎样下载apache HTTP Server服务器
我相信有些朋友刚用apache服务器时,都希望从官网上下载,而面对着官网上众多的项目和镜像以及目录,也许有点茫然.下面是具体步骤 第一步:打开apache官网 第二步:点击右上角Download,出现 ...
- Spring 官网jar下载
1,首先输入http://spring.io/进入Spring官网 2,点击project 栏,找到Spring framwork 3,点击reference 4,找到Distribution Zip ...
- 分享一个开源的网盘下载工具BaiduPCS-Go
大家在使用网盘的时候,一定忍受不了限速下载的速度.今天给大家分享一个开源的网盘下载项目BaiduPCS-Go.Go语言编写,仿 Linux shell 文件处理命令的百度网盘命令行客户端.多平台支持, ...
- centos官网镜像下载方法
1.CentoS简介 CentOS(Community Enterprise Operating System,社区企业操作系统)是一个基于Red Hat Linux 提供的可自由使用源代码的企业级L ...
- MongoDB 官网教程 下载 安装
官网:https://www.mongodb.com/ Doc:https://docs.mongodb.com/ Manual:https://docs.mongodb.com/manual/ 安装 ...
- 跑满带宽的一款百度网盘下载工具 : PanDownload
下载地址 : 点击进入 官网上面也有介绍使用.在这里,我再说一下 下载之后,解压,运行,登录, 登录好之后,准备进行设置 重要:下载情况分以下三部分 下载内容 < 300M,选择`打包下载`,只 ...
- 如何从oracle官网中下载The java language specification(java 语言规范)
第一步: 第二步: 第三步:下面这个图在这个页面的下方,所以你只要一直往下看,直到看到下图的文字为止: 第四步: 第五步: 这样你就可以成功下载该java 语言规范的pdf了. 它直接下载的网址为: ...
随机推荐
- cenots7单机安装Kubernetes
关于什么是Kubernetes请看另一篇内容:http://www.cnblogs.com/boshen-hzb/p/6482734.html 一.环境搭建 master安装的组件有: docker ...
- 【转载】如何选择MySQL存储引擎
一.MySQL的存储引擎 完整的引擎说明还是看官方文档:http://dev.mysql.com/doc/refman/5.6/en/storage-engines.html 这里介绍一些主要的引擎 ...
- HDU 6007 Mr. Panda and Crystal (背包+spfa)
题意:你生活在一个魔法大陆上,你有n 魔力, 这个大陆上有m 种魔法水晶,还有n 种合成水晶的方式,每种水晶价格告诉你,并且告诉你哪些水晶你能直接造出来,哪些你必须合成才能造出来,问你n魔力最多能卖多 ...
- MongoDBAppender
分三步: 1. client 2. appender 3. 配置文件 logback-test.xml <configuration> <appender name="MO ...
- APUE(4)---文件和目录 (1)
一.引言 上一章执行I/O的基本函数(打开文件.读文件和写文件),本章将描述文件系统的其他特征和文件的性质,我们将从stat函数开始,并逐个说明stat结构的每一个成员以了解文件的所有属性.在此过程中 ...
- Middleware / 中间件
中间件格式 module.exports = options => { return (ctx, next) => { // do something } } 中间件格式为一个高阶函数,外 ...
- ibatis源码学习2_初始化和配置文件解析
问题在详细介绍ibatis初始化过程之前,让我们先来思考几个问题. 1. ibatis初始化的目标是什么?上文中提到过,ibatis初始化的核心目标是构造SqlMapClientImpl对象,主要是其 ...
- linux 挂载和使用文件系统
从分区,到创建文件系统,再到把磁盘或分区挂载到一个目录后才能够使用. Windows或Mac系统会自动进行挂载,一旦创建好文件系统后会自动挂载到系统上,Windows我们称之为C\D盘,而Linux需 ...
- Android-Handler+Message-消息机制
我的理解是,子线程要和主线程通讯,就需要Handler+Message-消息机制 案例一:倒计时Demo(子线程+Handler+Message) package liudeli.async; imp ...
- Oracle 表关联性 Update 语句的改写,推荐改写方法1
同事写了一个逻辑稍复杂的Update 语句,觉得在代码可读性上有些转圈,交给我帮忙改下. 以下根据原SQL,使用两种方法进行改写,个人推荐方法1的改写.方法2拆分两个SQL来写,代码可读性最强,但是S ...