μ΄κ²μ μλ₯Ό 보μ¬μ€ μ μμ΅λκΉ?
ꡬμ±μ capabilities
μΉμ
μμ μ§μ ν΄μΌν©λλ€. μΉ λλΌμ΄λ² νλ‘μ μ© JSON ꡬμ±μ λ§λλ λ°©λ²μ λν μμΈν λ΄μ©μμ΄ λ¬Έμλ₯Ό νμΈνμΈμ. https://code.google.com/p/selenium/wiki/DesiredCapabilities#Proxy_JSON_Object
μλνμ§λ§ μ€μ λ‘λ μλνμ§ μμμ΅λλ€. λ΄ κ²½νμ΄ μμ μ μμ΅λλ€. λΉμ μ΄λ λꡬμκ² λ³΄μ¬μ€ μμλ κ°λ¨ν μκ° μμ΅λκΉ? κ·Έκ²μ λ¨Ό κΈΈμ κ° κ²μ λλ€.
capabilities: {
'proxy': {
'proxyType': 'manual',
'httpProxy': 'hostname.com:1234'
}
}
μ΄ μ루μ μ μ°λ¦¬μ μ€μ μμ μλνμ§ μμ΅λλ€. λ΄κ° λ μλͺ»νκ³ μλμ§ μμ΄λμ΄κ° μμ΅λκΉ? Protractorλ₯Ό μ€ννλ €κ³ ν λ λͺ λ Ή μ€μ λ€μ μ€λ₯κ° νμλ©λλ€.
> Fatal error: protractor exited with code: 1
λ΄ κ΅¬μ± νμΌμ λ€μκ³Ό κ°μ΅λλ€.
// A reference configuration file.
exports.config = {
// ----- How to setup Selenium -----
//
// There are three ways to specify how to use Selenium. Specify one of the
// following:
//
// 1. seleniumServerJar - to start Selenium Standalone locally.
// 2. seleniumAddress - to connect to a Selenium server which is already
// running.
// 3. sauceUser/sauceKey - to use remote Selenium servers via SauceLabs.
// The location of the selenium standalone server .jar file.
seleniumServerJar: './selenium/selenium-server-standalone-2.35.0.jar',
// The port to start the selenium server on, or null if the server should
// find its own unused port.
seleniumPort: null,
// Chromedriver location is used to help the selenium standalone server
// find chromedriver. This will be passed to the selenium jar as
// the system property webdriver.chrome.driver. If null, selenium will
// attempt to find chromedriver using PATH.
chromeDriver: './selenium/chromedriver',
// Additional command line options to pass to selenium. For example,
// if you need to change the browser timeout, use
// seleniumArgs: ['-browserTimeout=60'],
seleniumArgs: [],
// If sauceUser and sauceKey are specified, seleniumServerJar will be ignored.
// The tests will be run remotely using SauceLabs.
sauceUser: null,
sauceKey: null,
// ----- What tests to run -----
//
// Spec patterns are relative to the location of this config.
specs: [
'./e2e/*-spec.js'
],
// ----- Capabilities to be passed to the webdriver instance ----
//
// For a full list of available capabilities, see
// https://code.google.com/p/selenium/wiki/DesiredCapabilities
// and
// https://code.google.com/p/selenium/source/browse/javascript/webdriver/capabilities.js
capabilities: {
'browserName': 'chrome',
'proxy': {
'proxyType': 'manual',
'httpProxy': 'https://localhost.com:8443/'
}
},
// A base URL for your application under test. Calls to protractor.get()
// with relative paths will be prepended with this.
baseUrl: 'http://localhost:9999',
// Selector for the element housing the angular app - this defaults to
// body, but is necessary if ng-app is on a descendant of <body>
rootElement: 'body',
// ----- Options to be passed to minijasminenode -----
jasmineNodeOpts: {
// onComplete will be called just before the driver quits.
onComplete: null,
// If true, display spec names.
isVerbose: true,
// If true, print colors to the terminal.
showColors: true,
// If true, include stack traces in failures.
includeStackTrace: true,
// Default time to wait in ms before a test fails.
defaultTimeoutInterval: 10000
}
};
λλ λΉμ μ λ₯λ ₯μ μνν΄ λ³΄μκ³ κ·Έκ²μ λλ₯Ό μν΄ μλν©λλ€. κ°μ§ httpProxyλ₯Ό μ λ ₯νλ©΄ λΈλΌμ°μ μ 'could not connect to proxy'μ€λ₯κ° νμλμ§λ§ ν μ€νΈλ κ³μ μ€νλ©λλ€. νλ‘μμμ΄ ν μ€νΈκ° μ¬λ°λ₯΄κ² μ€νλ©λκΉ? μ΄ κ²½μ° μ΄λ»κ² μ€ν¨ν©λκΉ?
μ’μ, λ΄κ° μ°Ύμ κ²μ λ€μκ³Ό κ°μ΄ baseurlμ https ν μ€νΈ μ¬μ΄νΈλ‘ μ€μ νλ κ²μ λλ€.
exports.config = {
seleniumServerJar: './selenium/selenium-server-standalone-2.35.0.jar',
seleniumPort: null,
chromeDriver: './selenium/chromedriver',
seleniumArgs: [],
sauceUser: null,
sauceKey: null,
specs: [
'./e2e/*-spec.js'
],
capabilities: {
'browserName': 'chrome'
},
baseUrl: 'https://localhost:8443/',
rootElement: 'body',
jasmineNodeOpts: {
// onComplete will be called just before the driver quits.
onComplete: null,
// If true, display spec names.
isVerbose: true,
// If true, print colors to the terminal.
showColors: true,
// If true, include stack traces in failures.
includeStackTrace: true,
// Default time to wait in ms before a test fails.
defaultTimeoutInterval: 10000
}
};
μλ νμΈμ,
μ λ μ¬λ¬λΆμ΄ μ¬κΈ°μ ν μΌλ‘ νλ‘μλ₯Ό μλμν¬ μ μμμΌλ―λ‘ κ°μ¬ν©λλ€. μ΄μ λ΄λΆ μλΉμ€κ° νλ‘μλ‘ μ΄λνμ§ μλλ‘ μ μΈ ν μ μλλ‘ noProxy λ³μλ₯Ό μΆκ°νκ³ μΆμ΅λλ€. λ€μμ μλνμ§λ§ noProxy λΆλΆμ΄ μ¬μ©λμ§ μμ΅λλ€. PhantomJλ₯Ό μ¬μ©νκ³ μμ΅λλ€.
'proxy': {
'proxyType': 'manual',
'httpProxy': 'http://proxy.blah.co.uk:8080'
'httpsProxy': 'http://proxy.blah.co.uk:8080'
'noProxy': 'blah.blah.co.uk,*blah.blah.co.uk,.blah.blah.co.uk'
}
},
μλ
νμΈμ,
μΈμ¦ λ νλ‘μλ‘ μλνλλ‘ λ§λ€ μ μμ΅λλ€. λλ μλνλ€ :
'proxy': {
'proxyType': 'manual',
'httpProxy': 'user:[email protected]:3128'
'sslProxy': 'user:[email protected]:3128'
}
κ³Ό
'proxy': {
'proxyType': 'manual',
'httpProxy': 'http://user:[email protected]:3128'
'sslProxy': 'http://user:[email protected]:3128'
}
λΈλΌμ°μ Chromeμ μ¬μ©νμ¬ https://docs.angularjs.org/tutorial/step_03 μ μλ£νλ €κ³ ν©λλ€.
λμκ²λ μλνμ§ μμ΅λλ€-μ¬μ©μ μ΄λ¦ / μνΈμ ν¨κ» host : port λ₯Ό μ 곡ν΄μΌνλ©° μμ λͺ¨λ μ μμ μλνμ§λ§ μ무κ²λ μλνμ§ μλ κ² κ°μ΅λλ€. κ·Έλ¬λ νμ¬ μΈν°λ·μμ λ²μ΄λ νλ‘μμμ΄ μλνλ©΄ λͺ¨λ κ²μ΄ μ μλν©λλ€. λμμ΄ νμνμΈμ?
μ¬μ€ λ΄ λ¬Έμ λ μμ€ν λ³μλ₯Ό μ€μ νμ¬ ν΄κ²°λμμ΅λλ€.
http_proxy http://user:password<strong i="6">@proxy_url</strong>:port
https_proxy http://user:password<strong i="7">@proxy_url</strong>:port
μ¬κΈ° GE Softwareμμ λ€μ μ΄μ΄μΌν©λλ€. ꡬμ±μμ http_proxy λ° https_proxyλ₯Ό μ€μ ν΄λ Protractorκ° Saucelabsμ ν μ€νΈ κ²°κ³Όμ μ΅μ’ μ’ λ£ μ½λλ₯Ό 보λ΄λλ‘ νμ©νμ§ μμ Saucelabsκ° λΉνμ±μΌλ‘ μΈν΄ ν μ€νΈμ μ€ν¨νκ²λ©λλ€.
@jonniespratley κ° protractor config --proxy=http://user:password<strong i="6">@proxy_url</strong>:port
μλνμ§ μμ΅λκΉ?
λλ μμ€ μ€νμ€μμ κ°λκΈ° ν μ€νΈλ₯Ό μ€ννλ €κ³ μλνμ§λ§ ETIMEDOUT μ€λ₯κ° λ°μν©λλ€. νμ¬ λ°©νλ²½ λ€μ μμΌλ©° κ°λκΈ° κ΅¬μ± νμΌ λ° νκ²½ λ³μμ νλ‘μλ₯Ό ꡬμ±νμ΅λλ€. ꡬμ±μ΄ μλνμ§ μλ κ² κ°μ΅λλ€. μλλ λ΄κ° μ»λ μ€λ₯μ λλ€.
Error: ETIMEDOUT connect ETIMEDOUT 151.444.33.22:80
at ClientRequest.<anonymous> (/Users/user123/Desktop/Sample/example-sandbox/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:174:16)
at emitOne (events.js:77:13)
at ClientRequest.emit (events.js:169:7)
at Socket.socketErrorListener (_http_client.js:259:9)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at emitErrorNT (net.js:1253:8)
at doNTCallback2 (node.js:439:9)
at process._tickCallback (node.js:353:17)
From: Task: WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (/Users/user123/Desktop/Sample/example-sandbox/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:157:22)
at Function.webdriver.WebDriver.createSession (/Users/user123/Desktop/Sample/example-sandbox/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:131:30)
at [object Object].Builder.build (/Users/user123/Desktop/Sample/example-sandbox/node_modules/protractor/node_modules/selenium-webdriver/builder.js:445:22)
at [object Object].DriverProvider.getNewDriver (/Users/user123/Desktop/Sample/example-sandbox/node_modules/protractor/lib/driverProviders/driverProvider.js:42:27)
at [object Object].Runner.createBrowser (/Users/user123/Desktop/Sample/example-sandbox/node_modules/protractor/lib/runner.js:190:37)
at /Users/user123/Desktop/Sample/example-sandbox/node_modules/protractor/lib/runner.js:280:21
at _fulfilled (/Users/user123/Desktop/Sample/example-sandbox/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/Users/user123/Desktop/Sample/example-sandbox/node_modules/protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/Users/user123/Desktop/Sample/example-sandbox/node_modules/protractor/node_modules/q/q.js:796:13)
at /Users/user123/Desktop/Sample/example-sandbox/node_modules/protractor/node_modules/q/q.js:556:49
[launcher] Process exited with error code 1
μ΄λ€ μκ°? λμμ μ£Όμλ©΄ μ λ§ κ°μ¬νκ² μ΅λλ€.
λΉμ·ν μ€λ₯κ° λ°μν©λλ€. μ λ νμ¬ νλ‘μ λ€μ μκ³ browserstackμ ν μ€νΈλ₯Ό μ μΆν μ μμ΅λλ€.
/Users/Documents/coding/sublime/simpleboilerplate/node_modules/selenium-webdriver/lib/promise.js:654
throw error;
^
Error: ETIMEDOUT connect ETIMEDOUT 208.52.180.201:80
at ClientRequest.<anonymous> (/Users/Documents/coding/sublime/simpleboilerplate/node_modules/selenium-webdriver/http/index.js:381:15)
at emitOne (events.js:77:13)
at ClientRequest.emit (events.js:169:7)
at Socket.socketErrorListener (_http_client.js:259:9)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at emitErrorNT (net.js:1253:8)
at doNTCallback2 (node.js:441:9)
at process._tickCallback (node.js:355:17)
From: Task: WebDriver.createSession()
at Function.createSession (/Users/Documents/coding/sublime/simpleboilerplate/node_modules/selenium-webdriver/lib/webdriver.js:329:24)
at Builder.build (/Users/Documents/coding/sublime/simpleboilerplate/node_modules/selenium-webdriver/builder.js:458:24)
at Object.<anonymous> (/Users/Documents/coding/sublime/simpleboilerplate/bs.js:13:3)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:136:18)
at node.js:963:3
From: Task: WebDriver.navigate().to(http://www.google.com)
at WebDriver.schedule (/Users/Documents/coding/sublime/simpleboilerplate/node_modules/selenium-webdriver/lib/webdriver.js:377:17)
at Navigation.to (/Users/Documents/coding/sublime/simpleboilerplate/node_modules/selenium-webdriver/lib/webdriver.js:1027:25)
at WebDriver.get (/Users/Documents/coding/sublime/simpleboilerplate/node_modules/selenium-webdriver/lib/webdriver.js:795:28)
at Object.<anonymous> (/Users/Documents/coding/sublime/simpleboilerplate/bs.js:15:8)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:136:18)
νμ¬ νλ‘μλ₯Ό λ²μ΄λ perfecto mobileμ μ
λ λ μλ²λ‘ μ΄λνλ λ° λ§μΉ¨λ΄ λμμ΄ λ κ²μ webDriverProxy
ꡬμ±μ μ¬μ©νλ κ²μ
λλ€.
exports.config = {
framework: 'jasmine',
seleniumAddress: 'https://yourCloudName.perfectomobile.com/nexperience/perfectomobile/wd/hub',
webDriverProxy: 'http://your.proxy.here:8080',
capabilities: { ... },
specs: ['myspec.js']
};
λλ νμ¬ νλ‘μ λ€μμ μΌνκ³ μλλ° conf.js μμ΄ μ½λλ₯Ό μΆκ°νλ €κ³ μλνμ΅λλ€.
'νλ‘μ': {
'proxyType': 'μλ',
'httpProxy': ' user : [email protected] : 8080'
'sslProxy': ' user : [email protected] : 8080'
}
μ λλ‘ μλνμ§λ§ μμ© νλ‘κ·Έλ¨ μ€ν μκ°μ΄ μ¦κ°νμ¬ κ²°κ³Όκ° μ€ν¨νμ΅λλ€. μ κΈ°λ³Έ μκ°μ λ릴 μ μμ§λ§ μμ© νλ‘κ·Έλ¨μ μ€ννλ λ° λ μ€λ κ±Έλ¦¬μ§ μκΈ°λ₯Ό λ°λλλ€.
λꡬλ μ§μ΄ λ¬Έμ λ₯Ό ν΄κ²°νλλ‘ λμΈ μ μμ΅λκΉ?
미리 κ°μ¬λ립λλ€.
@gregjacobs λλ perfectoμ ν¨κ» webDriverProxyλ₯Ό μ¬μ©νκ³ μμ΅λλ€. κ·Έκ²μ μ μ λμ λλ₯Ό μν΄ μΌνμ΅λλ€. 4.x λλ 5.xλ‘ μ κ·Έλ μ΄λ ν ν λ μ΄μ μλνμ§ μμ΅λλ€. μ κ·Έλ μ΄λ νμλ μ¬μ ν μλν©λκΉ?
https://github.com/angular/protractor/blob/master/lib/config.ts μ νλ‘μ μ΅μ μ€ μ΄λ κ²λ λλ₯Ό μν΄ μλνμ§ μμ΅λλ€. μ무λ v5μμ νλ‘μλ₯Ό ꡬμ±νλ λ° νμ΄μ΄ μμμ΅λκΉ?
λΏ‘ λΉ΅λ¨
μ΄λ¬ν κΈ°λ₯μ κ°μΆ BrowserMob νλ‘μ λ° κ°λκΈ° μ€μ -μ μλν©λλ€.
capabilities: {
'browserName': 'chrome',
'args': ['disable-web-security'],
'proxy': {
'proxyType': 'manual',
'httpProxy': '10.179.70.127:10801',
'sslProxy': '10.179.70.127:10801',
"autodetect": 'false'
}
}
@gregjacobs webDriverProxy
μμ±μ μ¬μ©λλ νλ‘μμ μ¬μ©μ μ΄λ¦ / μνΈλ₯Ό μ§μ ν΄μΌν©λλ€. μ΄λ»κ² μμ?
@ luker2 λΆννλ μ νν μ λͺ¨λ₯΄κ² μ§λ§ webDriverProxy: 'http://username:[email protected]:8080'
μλνμ§ μμ΅λκΉ? ( 8080
λ νλ‘μμ ν¬νΈμ
λκΉ?)
@gregjacobs μ, μμ§ νμ μ‘°μΉλ₯Ό μ·¨νμ§ μμμ§λ§ κ·Έκ²μ΄ κ²°κ΅ μλνμ΅λλ€!
λ€λ₯Έ μ¬λλ€μ κ²½μ° νΉμ λ¬Έμλ₯Ό μ΄μ€μΌμ΄ννκΈ° μν΄ username : password λΆλΆμ ββURL μΈμ½λ©ν΄μΌνμ΅λλ€.
webDriverProxy: `http://${encodeURIComponent(username)}:${encodeURIComponent(password)}@your.proxy.here:8080`
@ luker2 κ΅μ₯ν©λλ€, λΉμ μ΄ μλνλ κ²μ λ£κ³ κΈ°μ©λλ€! κ·Έλ¦¬κ³ μ¬μ©μ μ΄λ¦κ³Ό μνΈλ₯Ό μΈμ½λ©νλ uriμ λν κΈμ κ²μ ν΄ μ£Όμ μ κ°μ¬ν©λλ€.
κ°μ₯ μ μ©ν λκΈ