Google 자동 도움말 드롭과 같은 자동 생성 드롭을 작성했으며 그 결과 값을 출력으로 인쇄하려고했습니다. 셀레늄 WebDriver에Selenium Web Driver : findElementsBy() 함수가 PHP-webdriver-bindings에서 오류를 반환했습니다.
는
제가 결합 당 같이
<?php
require_once 'www/library/phpwebdriver/WebDriver.php';
class PHPWebDriverTest extends PHPUnit_Framework_TestCase {
protected $webdriver;
protected function setUp() {
$this->webdriver = new WebDriver("localhost", 4444);
$this->webdriver->connect("firefox");
}
protected function tearDown() {
// $this->webdriver->close();
}
public function testgooglesearch() {
$this->webdriver->get("http://google.com");
$element=$this->webdriver->findElementBy(LocatorStrategy::name, "q");
$element->sendKeys(array("selenium"));
$result=$this->webdriver->findElementsBy(LocatorStrategy::xpath,"//*[@id=\'gsr\']/table/tbody/tr/td[2]/table/tbody/tr[*]/td/");
echo $countresult=count($result);
}
}
?>
아래 주어진 작성한 코드 우리 findElementsBy() 함수를 사용하여 가지고 XPath는 로케이터와 일치 여러 요소를 잡을 findElementsBy() 함수는 배열을 반환한다고 가정합니다. 그래서 배열 길이를 계산하려고 할 때 오류가 반환됩니다.
오류 : 개체가 아닌 속성을 얻으려고합니다.
내가 어떻게 진행할 수 있는지 알려주세요.
** 어떤 ** 오류 아래에 주어진? – Arran
배열이 인쇄되고 있다는 웹 위에 예외가 표시됩니다. – John
PHP 바인딩은 무엇입니까? 꽤 많은 것들이 있으며 Selenium 개발팀이 공식적으로 지원하지 않습니다. – Ardesco