dtslobe4694 2015-04-02 16:46
浏览 95

Firefox与selenium-server-standalone-2.45.0

I have followed the tutorial on: github[dot]com/aik099/en-mink[dot]behat[dot]org/blob/master/index[dot]rst

to run Mink/selenium on a php script.

I am running selenium-server-standalone-2.45.0 with Firefox 28 (went down from version 37), but keep on getting an error:

Fatal error: Uncaught exception 'WebDriver\Exception\UnknownError' with message 'Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: Error: no display specified Error: no display specified  in...

When searching the error online, I have only found that I should downgrade Firefox below 35 for the current selenium version. What am I then still doing wrong?

Then I went and installed Google Chrome, with the following error:

Fatal error: Uncaught exception 'WebDriver\Exception\UnknownError' with message 'The path to the driver executable must be set by the webdriver.opera.driver system property;

for more information, see github[dot]com/operasoftware/operachromiumdriver. The latest version can be downloaded from github[dot]com/operasoftware/operachromiumdriver/releases' in...

Extra info: Running this script on a VPS with centos 6 installed.

PHP script of code:

    <?php
require_once 'vendor/autoload.php';

$driver = new \Behat\Mink\Driver\Selenium2Driver(
    'firefox', 'thewebsitebase'
);
//have replace firefox with google-chrome

// init session:
$session = new \Behat\Mink\Session($driver);

// start session:
$session->start();

// open some page in browser:
$session->visit('thewebsite');

// get the current page URL:
echo $session->getCurrentUrl();

// get the response status code:
echo $session->getStatusCode();

// get page content:
echo $session->getPage()->getContent();

// evaluate JS expression:
echo $session->evaluateScript(
    "return 'something from browser';"
);

?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向