tzander/page-factory 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tzander/page-factory

Composer 安装命令:

composer require tzander/page-factory

包简介

Php PageFactory for Selenium2

README 文档

README

Supports the PageObject pattern for PHP with Selenium2

Installation

Install with composer

{
    "require": {
        "tzander/page-factory": "dev-master"
    }
}

Example

You need to include the Autoload.php and create a page class.

 require_once __DIR__ . '/library/Autoload.php';

 class BingSearchPage {

    /**
     * @var PHPUnit_Extensions_Selenium2TestCase_Element
     */
     public $sb_form_q;

     public function search() {
         $this->sb_form_q->value('selenium');
         $this->sb_form_q->submit();
         return PageFactory::initElements($this->getTestCase(), 'SearchResultPage');
     }
 }

The property must be public and either the name or the id attribute of the element.

Now in order to have an initialized object to return we need to to the following:

  class  SearchTest{

    public function shouldfindSelenium(){
          $page = PageFactory::initElements($this, 'BingSearchPage');
          $resultPage = $page->search();
          $this->assertInstanceOf('SearchResultPage', $resultPage);
    }
  }

Using Annotation

You can also use the @find annotations in order to locate the element.

  /**
  * @find byXpath='a[@class=test]'
  */
  public $link;

Or any of these find methods:

byId, byName, byXpath, byCssSelector ,byClassName.

统计信息

  • 总下载量: 5.08k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-01-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固