How to use Codeception & Webdriver

Bỏ codeception lâu quá gần như quên sạch. Nên thôi giờ có dịp work on it again nên write down lại để nhớ.

Composer để install codeception

composer require codeception/codeception --dev

From now on Codeception (with installed PHPUnit) can be run as

php vendor/bin/codecept


php vendor/bin/codecept bootstrap

Edit acceptant file

# Codeception Test Suite Configuration
# Suite for acceptance tests.
# Perform tests in browser using the WebDriver or PhpBrowser.
# If you need both WebDriver and PHPBrowser tests - create a separate suite.

actor: AcceptanceTester
  - WebDriver:
      url: 'http://localhost/phpmyadmin'
      window_size: false
      port: 9515
      browser: chrome
          binary: ''
  • Binary sẽ là path đến chrome binary
  • URL dĩ nhiên là path đến trang cần làm việc

Okay giờ cần chạy ChromeDriver trước

chromedriver --url-base=/wd/hub

Rồi chạy codeception

php vendor/bin/codecept run

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Up ↑

%d bloggers like this: