dongwaner1367 2013-08-07 18:57
浏览 50

PHP Webdriver - 目标页面无法在浏览器中加载

New to Selenium 2. Here's the issue: each time I run a test, the browser opens but refuses to load URLs. I simply get a blank page. Here's an example using Łukasz Kolczyński's bindings:

require_once "phpwebdriver/WebDriver.php";

$webdriver = new WebDriver("localhost", "4444");
$webdriver->connect("chrome");                            
$webdriver->get("http://google.com");
$element = $webdriver->findElementBy(LocatorStrategy::name, "q");
if ($element) {
    $element->sendKeys(array("php webdriver" ) );
    $element->submit();
}

$webdriver->close();

I simply get "data:text/html;charset=utf-8," in the address bar. Then the script closes.

I'm sure I'm doing something wrong. Any help would be greatly appreciated.

Notes: I'm currently running chromedriver, chrome 28, php 5.4.9, and OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)

  • 写回答

2条回答 默认 最新

  • dsgs8208 2013-08-08 04:47
    关注

    After 24 hours of frustration, I concluded that the unofficial php bindings are not worth the trouble. Judging by some of the feedback on Github, I think this is a common complaint.

    I decided to try one of the official APIs. The Python implementation works great. I found it was faster to learn some Python and write my tests in a new language than troubleshoot the PHP bindings.

    Now that I've trashed the php code, I'm sure I'll learn that I missed something obvious. :)

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大