Thursday, March 17, 2016

PhantomJS cannot visit Self-signed HTTPS pages Codeception

Leave a Comment

Im currently making an acceptance test with the following tools:

  • Codeception
  • Selenium Webdriver
  • PhantomJS (as headless browser ghost)

My problem is My Tests fail when visiting a self-signed (https) page

What I've tried:

  1. phantomjs --webdriver=5555 --ignore-ssl-errors=true --ssl-protocol=any
  2. Adding this in capabilities phantomjs.cli.args: ["--ignore-ssl-errors=true"] in my acceptance.suit.yml

So far these options doesnt give me any luck.

Here is my acceptance.suit.yml file

class_name: AcceptanceTester modules:     enabled:         - WebDriver     config:         WebDriver:             url: https://myproject.com             browser: firefox             capabilities:                 unexpectedAlertBehaviour: 'accept'  env:     phantom:         modules:             enabled:                 - WebDriver             config:                 WebDriver:                     url: https://myproject.com                     http_proxy: 192.1.1.1                     http_proxy_port: 3000                     browser: phantomjs                     capabilities:                         phantomjs.cli.args: ["--ignore-ssl-errors=true"] 

UPDATE

This error shows up [ModuleException] WebDriver: Current url is blank, no page was opened

I don't know why this error happens since I've indicated a page. Here is a sample of my test

public function tryToTestThis(AcceptanceTester $I) {     $I->wantTo('Test this function');     $I->amOnPage('/mypage/');     $I->see('This text'); } 

An answer in Codeception would be preferable. Thanks

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment