【发布时间】:2020-02-18 01:17:21
【问题描述】:
我在 youtube 上找到了一个关于在 windows 中使用 php 的 selenium webdriver 的教程。我已经设置了 xampp,安装了一些依赖项,以及 jar 文件和 geckodriver 之类的其他依赖项。当我执行php代码时。我得到了这个错误。
Notice: Undefined property: stdClass::$ELEMENT in C:\xampp\htdocs\sample1\phpwebdriver\WebElement.php on line 28
这是我的 php 代码:
<?php
/*
Copyright 2011 3e software house & interactive agency
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
require_once "phpwebdriver/WebDriver.php";
$webdriver = new WebDriver("localhost", "4444");
$webdriver->connect("firefox");
$webdriver->get("http://google.com");
$element = $webdriver->findElementBy(LocatorStrategy::name, "q");
if ($element) {
$element->sendKeys(array("hello" ) );
$element->submit();
}
?>
请有人帮忙,我已经为这个错误工作了 2 天。我不知道该怎么办。提前感谢,如果有人有答案,真的很感激。
【问题讨论】:
-
这是文件:WebElement.php 吗?
标签: php webdriver geckodriver