本文整理汇总了PHP中Behat\Mink\Session::executeScript方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::executeScript方法的具体用法?PHP Session::executeScript怎么用?PHP Session::executeScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Behat\Mink\Session
的用法示例。
在下文中一共展示了Session::executeScript方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _shoot_shot
/**
*
* @param \Pachico\Voyeur\Shot $shot
* @return string
*/
protected function _shoot_shot(Shot $shot)
{
// Starting sesion if not started yet (in short, open browser)
if (!$this->_session->isStarted()) {
$this->_log_out('Starting camera session');
$this->_session->start();
}
$this->_log_out('Loading ' . $shot->get_uri());
$this->_log_out("Resizing window to " . $shot->get_width() . 'x' . $shot->get_height());
$this->_session->resizeWindow($shot->get_width(), $shot->get_height());
// Load page
$this->_session->visit($shot->get_uri());
$this->_log_out("Loading finished");
// Should I wait for something?
if (count($shot->get_wait_for()) > 0) {
foreach ($shot->get_wait_for() as $waitings) {
$wait_time = key($waitings);
$condition = is_null(current($waitings)) ? null : current($waitings);
$this->_log_out("Waiting " . $wait_time . ' microseconds');
$condition and $this->_log_out("Or until " . $condition);
$this->_session->wait($wait_time, $condition);
}
}
// Any scripts to execute?
if (count($shot->get_scripts()) > 0) {
foreach ($shot->get_scripts() as $script) {
$script = $this->_get_script_file_content($script);
$this->_session->executeScript($script);
}
}
// Finally take the screenshot and return it
$this->_log_out("Taking screenshot");
$picture = $this->_session->getScreenshot();
return $picture;
}
示例2: testExecuteScript
public function testExecuteScript()
{
$this->driver->expects($this->once())->method('executeScript')->with($arg = 'JS');
$this->session->executeScript($arg);
}