nearsoft/php-selenium-client 问题修复 & 功能扩展

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

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

nearsoft/php-selenium-client

Composer 安装命令:

composer require --dev nearsoft/php-selenium-client

包简介

This library allows creating Selenium Server V2 tests in PHP. It communicates with the WebDriver API through the official JsonWireProtocol.

README 文档

README

PHP interaction with Selenium Webdriver API

##Description

This library allows the interaction with Selenium Server V2 in PHP. It communicates with the WebDriver API through the official JsonWireProtocol.

One of the goals is to provide a client usage as close as possible to the Selenium Official libraries (such as Java's, c#'s). Most methods are named as the same as of these libraries'. In this way, whenever a developer runs into ideas or documentation in Java Client, the same techniques can be implemented by using this library.

##Documentation

Version 2

Version 1

##Quickstart

  • Start a session by creating an instance of WebDriver. By default, the test will run in firefox

      $driver = new WebDriver();
    
  • As an alternative you can define desired capabilities for the session

      $desiredCapabilities = new DesiredCapabilities("chrome");
      $driver = new WebDriver($desiredCapabilities);
    
  • Navigate by using the WebDriver::get method from the WebDriver Class

      $driver->get("www.nearsoft.com");
    
  • Get elements from the DOM in current location

      $textbox1 = $driver->findElement(By::id("someTextBoxId"));
      
      $button1 = $driver->findElement(By::cssSelector("html body div#content input#someButtonId"));
    
  • Manipulate located elements

      $textbox1->sendKeys("Some text to send");
      
      $textbox1->getAttribute("value");
      
      $button1->click();
    
  • Find element within elements

      $modal1->findElement(By::id("someModalId"));
      $listItems = $modal1->findElements(By::tagName("li"));
    
  • Switch between windows

      $driver->switchTo()->window("windowName");
    
  • Manage alerts $alert = $driver->switchTo()->alert(); $alert->getText(); $alert->accept(); $alert->dismiss();

  • Wait for elements to be present

      $webElement = $driver->waitForElementUntilIsPresent(By::id("someElementId"));
      
      //or
      
      $wait = new WebDriverWait(8);
      $webElement = $wait->until($driver,"findElement",array(By::id("someElementId"),true));
    

统计信息

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

GitHub 信息

  • Stars: 107
  • Watchers: 23
  • Forks: 39
  • 开发语言: PHP

其他信息

  • 授权协议: Apache
  • 更新时间: 2013-10-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固