我尝试对 PHP Unit 和 Selenium 服务器进行一些测试。 我有一个令人难以置信的问题,我不知道为什么。
我使用的是最新的 Selenium stand server 2.42.2。当我运行服务器时,它显示如下:
root@test:/home/jakub# java -jar /usr/local/bin/selenium-server-standalone-2.42.2.jar
Jun 30, 2014 4:32:53 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
16:32:53.398 INFO - Java: Oracle Corporation 24.51-b03
16:32:53.399 INFO - OS: Linux 3.12-1-amd64 amd64
16:32:53.413 INFO - v2.42.2, with Core v2.42.2. Built from revision 6a6995d
16:32:53.508 INFO - Default driver org.openqa.selenium.ie.InternetExplorerDriver
registration is skipped: registration capabilities Capabilities [{platform=WINDOWS,
ensureCleanSession=true, browserName=internet explorer, version=}] does not match
with
current platform: LINUX
16:32:53.563 INFO - RemoteWebDriver instances should connect to:
http://test.jacon.cz:4444/wd/hub
16:32:53.564 INFO - Version Jetty/5.1.x
16:32:53.565 INFO - Started HttpContext[/selenium-server/driver,/selenium-server
/driver]
16:32:53.566 INFO - Started HttpContext[/selenium-server,/selenium-server]
16:32:53.566 INFO - Started HttpContext[/,/]
16:34:07.013 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@7cbae009
16:34:07.014 INFO - Started HttpContext[/wd,/wd]
16:34:07.022 INFO - Started SocketListener on 0.0.0.0:4444
16:34:07.023 INFO - Started org.openqa.jetty.jetty.Server@17056563
看来 Selenium 服务器运行正常。但是当我尝试使用 PHPUnit 在 php 中运行简单测试时,它说它无法连接到 Selenium 服务器。
root@test:/home/jakub# /usr/local/bin/phpunit --verbose sel.php
PHPUnit 4.1.3 by Sebastian Bergmann.
SS
Time: 73 ms, Memory: 3.25Mb
There were 2 skipped tests:
1) loginTest::testLoginTrue
The Selenium Server is not active on host http://test.jacon.cz at port 4444.
2) loginTest::testLoginFalse
The Selenium Server is not active on host http://test.jacon.cz at port 4444.
OK, but incomplete, skipped, or risky tests!
Tests: 2, Assertions: 0, Skipped: 2.
我通过 netstat -apn | 检查过grep 4444 如果 Selenium 服务器正在监听端口 4444 并且它正在监听。有人知道如何解决这个问题吗?我用谷歌搜索,但没有任何结果。
顺便说一句。这是 php 中的测试代码:
<?php
class loginTest extends PHPUnit_Extensions_Selenium2TestCase
{
protected $captureScreenshotsOnFailure = TRUE;
protected $screenshotsPath = '';
protected $screenshotsUrl = '';
protected function SetUp()
{
$this->setBrowser('chrome');
$this->setBrowserUrl('http://test.jacon.cz/');
//$this->setPort(4444);
//$this->setTimeout(2);
$this->setHost("http://test.jacon.cz");
}
public function testLoginTrue()
{
$this->url('/sms');
$this->byName('username')->value('Kristyna');
$this->byName('password')->value('*****');
$this->byCssSelector('form')->submit();
$url = $this->url();
$this->assertEquals('Statistics', $this->title(), 'Přihlášení neproběhlo');
$this->assertStringEndsWith('sms/', $this->url(), 'Přihlášení neproběhlo');
}
public function testLoginFalse()
{
$this->url('/sms');
$this->byName('username')->value('abcdefgh');
$this->byName('password')->value('123456');
$this->byCssSelector('form')->submit();
$url = $this->title();
$this->assertEquals('Login to SM', $this->title(), 'Přihlášení proběhlo');
}
}
?>
希望你能帮上忙。谢谢。
最佳答案
PHPUnit 安装错误。现在一切正常,非常感谢所有提示和答案。
关于php - Selenium 服务器 - PHPUnit 无法连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24492785/
我正在尝试使用ruby和Savon来使用网络服务。测试服务为http://www.webservicex.net/WS/WSDetails.aspx?WSID=9&CATID=2require'rubygems'require'savon'client=Savon::Client.new"http://www.webservicex.net/stockquote.asmx?WSDL"client.get_quotedo|soap|soap.body={:symbol=>"AAPL"}end返回SOAP异常。检查soap信封,在我看来soap请求没有正确的命名空间。任何人都可以建议我
我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-
我想安装一个带有一些身份验证的私有(private)Rubygem服务器。我希望能够使用公共(public)Ubuntu服务器托管内部gem。我读到了http://docs.rubygems.org/read/chapter/18.但是那个没有身份验证-如我所见。然后我读到了https://github.com/cwninja/geminabox.但是当我使用基本身份验证(他们在他们的Wiki中有)时,它会提示从我的服务器获取源。所以。如何制作带有身份验证的私有(private)Rubygem服务器?这是不可能的吗?谢谢。编辑:Geminabox问题。我尝试“捆绑”以安装新的gem..
我对最新版本的Rails有疑问。我创建了一个新应用程序(railsnewMyProject),但我没有脚本/生成,只有脚本/rails,当我输入ruby./script/railsgeneratepluginmy_plugin"Couldnotfindgeneratorplugin.".你知道如何生成插件模板吗?没有这个命令可以创建插件吗?PS:我正在使用Rails3.2.1和ruby1.8.7[universal-darwin11.0] 最佳答案 随着Rails3.2.0的发布,插件生成器已经被移除。查看变更日志here.现在
我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r
我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e
我正在使用Sequel构建一个愿望list系统。我有一个wishlists和itemstable和一个items_wishlists连接表(该名称是续集选择的名称)。items_wishlists表还有一个用于facebookid的额外列(因此我可以存储opengraph操作),这是一个NOTNULL列。我还有Wishlist和Item具有续集many_to_many关联的模型已建立。Wishlist类也有:selectmany_to_many关联的选项设置为select:[:items.*,:items_wishlists__facebook_action_id].有没有一种方法可以
我花了三天的时间用头撞墙,试图弄清楚为什么简单的“rake”不能通过我的规范文件。如果您遇到这种情况:任何文件夹路径中都不要有空格!。严重地。事实上,从现在开始,您命名的任何内容都没有空格。这是我的控制台输出:(在/Users/*****/Desktop/LearningRuby/learn_ruby)$rake/Users/*******/Desktop/LearningRuby/learn_ruby/00_hello/hello_spec.rb:116:in`require':cannotloadsuchfile--hello(LoadError) 最佳
最近,当我启动我的Rails服务器时,我收到了一长串警告。虽然它不影响我的应用程序,但我想知道如何解决这些警告。我的估计是imagemagick以某种方式被调用了两次?当我在警告前后检查我的git日志时。我想知道如何解决这个问题。-bcrypt-ruby(3.1.2)-better_errors(1.0.1)+bcrypt(3.1.7)+bcrypt-ruby(3.1.5)-bcrypt(>=3.1.3)+better_errors(1.1.0)bcrypt和imagemagick有关系吗?/Users/rbchris/.rbenv/versions/2.0.0-p247/lib/ru
在Rails4.0.2中,我使用s3_direct_upload和aws-sdkgems直接为s3存储桶上传文件。在开发环境中它工作正常,但在生产环境中它会抛出如下错误,ActionView::Template::Error(noimplicitconversionofnilintoString)在View中,create_cv_url,:id=>"s3_uploader",:key=>"cv_uploads/{unique_id}/${filename}",:key_starts_with=>"cv_uploads/",:callback_param=>"cv[direct_uplo