大佬教程收集整理的这篇文章主要介绍了angularjs – angular2 selenium webdriver:无法解析’child_process,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
ng new typescript-SELEnium-example npm install SELEnium-webdriver --save
(另外我已经将chromedriver复制到我的/ Application)
将app.component.ts更新为:
import { Component } from '@angular/core'; import { Builder,By,until } from 'SELEnium-webdriver'; @Component({ SELEctor: 'app-root',templateUrl: './app.component.html',styleUrls: ['./app.component.css'] }) export class AppComponent { constructor() { var driver = new Builder() .forBrowser('chrome') .build(); driver.get('http://www.google.com/ncr') .then(_ => driver.findElement(By.name('q')).sendKeys('webdriver')) .then(_ => driver.findElement(By.name('btnG')).click()) .then(_ => driver.wait(until.titleIs('webdriver - Google Search'),1000)) .then(_ => driver.quit()); console.log('hi'); } title = 'app works!'; }
得到错误:
ERROR in ./~/SELEnium-webdriver/net/portprober.js Module not found: Error: Can't resolve 'child_process' in '/Users/myname/tmp/typescript-SELEnium-example/node_modules/SELE nium-webdriver/net' @ ./~/SELEnium-webdriver/net/portprober.js 20:11-35 @ ./~/SELEnium-webdriver/chrome.js @ ./~/SELEnium-webdriver/index.js @ ./src/app/app.component.ts @ ./src/app/index.ts @ ./src/main.ts @ multi main ERROR in ./~/SELEnium-webdriver/firefox/binary.js Module not found: Error: Can't resolve 'child_process' in '/Users/myname/tmp/typescript-SELEnium-example/node_modules/SELE nium-webdriver/firefox' @ ./~/SELEnium-webdriver/firefox/binary.js 25:14-38 @ ./~/SELEnium-webdriver/firefox/index.js @ ./~/SELEnium-webdriver/index.js @ ./src/app/app.component.ts @ ./src/app/index.ts @ ./src/main.ts @ multi main ERROR in ./~/SELEnium-webdriver/io/exec.js Module not found: Error: Can't resolve 'child_process' in '/Users/myname/tmp/typescript-SELEnium-example/node_modules/SELE nium-webdriver/io' @ ./~/SELEnium-webdriver/io/exec.js 20:21-45 @ ./~/SELEnium-webdriver/remote/index.js @ ./~/SELEnium-webdriver/index.js @ ./src/app/app.component.ts @ ./src/app/index.ts @ ./src/main.ts @ multi main
import {describE} from 'SELEnium-webdriver';
要么
import {BeforeEach} from "SELEnium-webdriver/tesTing";
以上是大佬教程为你收集整理的angularjs – angular2 selenium webdriver:无法解析’child_process全部内容,希望文章能够帮你解决angularjs – angular2 selenium webdriver:无法解析’child_process所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。