最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Added cursor only displayed when moving to button elements - Stack Overflow

programmeradmin0浏览0评论

I'm following this example in terms of adding a cursor to the captured video when running my test:

Visualize / Show mouse cursor position in selenium 2 tests (for example PHPUnit Webdriver)

I've noticed, in the captured video, only form buttons will display the cursor. If the test clicks on any other id (ex. div, a), the cursor doesn't show.

Here's my custom click() method:

<?php
protected function click($id)
{
    //unfortunately, element wait is outside of this function, assume id present ATM
    $this->driver->executeScript("enableCursor();");
    $action = new WebDriverActions($this->driver);
    $el = $this->findById($id);        
    $action->moveToElement($el);
    //wait, in seconds, before clicking - maybe what's missing to display the cursor?
    $this->driver->manage()->timeouts()->implicitlyWait(2);
    $action->click()->perform();
}

// find element with ID specified
protected function findById($id)
{
    return $this->driver->findElement(WebDriverBy::id($id));
}

Update #1

Getting a bit more visuals this way, than with the cursor. However, some clicks are missing.

$css = "document.getElementById('".$id."').style = 'border: 2px solid red;';";
$this->driver->executeScript($css);
发布评论

评论列表(0)

  1. 暂无评论