2016-02-20 73 views
0

我有一個帶有letsencrypt ssl證書的網站。當我對它進行代碼驗收測試時,測試停止,直到按下ctrl + z。當我對一個非SSL站點運行相同的測試時,沒有問題。針對自簽名SSL網站運行代碼驗收測試

這是我在accept.suite.yml中的設置。該phantomjs.cli.args paramater是從該網站:http://szdredd.blogspot.de/2013/10/codeception-phantomjs-setup-for.html

class_name: AcceptanceTester 
modules: 
    enabled: [WebDriver] 
    config: 
     WebDriver: 
      url: https://www.domain.de/ 
      browser: phantomjs 

我的硒日誌看起來是這樣的:

17:07:15.681 INFO - Executing: [new session: Capabilities [{browserName=phantomjs}]]) 
17:07:15.682 INFO - Creating a new session for Capabilities [{browserName=phantomjs}] 
17:07:15.682 INFO - executable: /usr/bin/phantomjs 
17:07:15.683 INFO - port: 27757 
17:07:15.683 INFO - arguments: [--webdriver=27757, --webdriver-logfile=/phantomjsdriver.log] 
17:07:15.683 INFO - environment: {} 
PhantomJS is launching GhostDriver... 
[INFO - 2016-02-20T17:07:15.754Z] GhostDriver - Main - running on port 27757 
[INFO - 2016-02-20T17:07:15.765Z] Session [64316920-d7f4-11e5-a0c5-8954be0ea076] - CONSTRUCTOR - Desired Capabilities: {"browserName":"phantomjs"} 
[INFO - 2016-02-20T17:07:15.765Z] Session [64316920-d7f4-11e5-a0c5-8954be0ea076] - CONSTRUCTOR - Negotiated Capabilities: {"browserName":"phantomjs","version":"1.9.0","driverName":"ghostdriver","driverVersion":"1.0.3","platform":"linux-unknown-64bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}} 
[INFO - 2016-02-20T17:07:15.765Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: 64316920-d7f4-11e5-a0c5-8954be0ea076 
17:07:15.771 INFO - Done: [new session: Capabilities [{browserName=phantomjs}]] 
17:07:15.774 INFO - Executing: [implicitly wait: 0]) 
17:07:15.777 INFO - Done: [implicitly wait: 0] 
17:07:15.790 INFO - Executing: [get: https://www.waldhelden.de/]) 
[INFO - 2016-02-20T17:07:33.916Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW 
[INFO - 2016-02-20T17:08:55.442Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW 

[INFO - 2016-02-20T17:09:02.008Z] SessionManagerReqHand - _cleanupWindowlessSessions - 異步會話清理階段開始NOW 17:09:13.204 INFO - 會話7c5ef02c-9361-49c8-894d-234989179189由於客戶端超時而被刪除 [INFO - 2016-02-20T17:09:13.211Z] ShutdownReqHand - _handle - 即將關機

我發現在這一側的提醒,但是當我再補充一點的配置我的錯誤:

capabilities: 
    phantomjs.cli.args: ['--ignore-ssl-errors=true'] 

Caused by: org.openqa.selenium.WebDriverException: The best matching driver provider org.openqa.selenium.htmlunit.HtmlUnitDriver can't create a new driver instance for Capabilities [{phantomjs.cli.args=[--ignore-ssl-errors=true], browserName=phantom}] 

誰知道如何設置codeception忽略SSL錯誤?任何幫助感謝!

感謝 烏

回答

0

爲了測試我的地盤我用Phantoman自動運行並關閉phantomJS。在codeception.yml我有:

config: 
    Codeception\Extension\Phantoman: 
     path: 'vendor/bin/phantomjs' 
     port: 4444 
     debug: true 
     ignoreSslErrors: true 
     sslProtocol: any 
    Codeception\Extension\Recorder: 
     delete_successful: true