Tag: ghostdriver

WebdriverJS / IO&PhantomJS – 使用属性select器的Click处理程序不能与PhantomJS一起使用

我目前正在用WebdriverJS和PhantomJS编写一个应用程序testing套件。 为了确保我的testing工作,我首先通过Chrome运行它们,并且它们都正常工作。 当我换出PhantomJS的Chrome时,testing会中断。 这个问题 – WebDriver PhantomJS无法find元素,但与Firefox工作正常似乎概述了一个非常类似的问题,但附带的解决scheme似乎没有帮助。 下面是一个在Chrome上可以使用的types的简单例子,但不是PhantomJS上的例子: var client = webdriverjs.remote({ desiredCapabilities: { browserName: 'chrome' }, logLevel: 'silent' }); client.waitForExist("[data-id='1568911']", function(e){ client.click("[data-id='1568911']", function(e){ assert(!e, "Should click on a specific element:" + element); }); }); 在PhantomJS上运行时,我显然首先更改WebdriverJS选项: var client = webdriverjs.remote({ desiredCapabilities: { browserName: 'phantomjs', 'phantomjs.binary.path': "path/to/phantomjs" }, logLevel: 'silent' }); 但是当我运行testing并将logLevel设置为“详细”时,我收到如下所示的错误消息: [12:43:34]: COMMAND POST "/wd/hub/session/eb2b0a4b-e659-4607-bec0-82209bd6539a/element" […]

无法启动Selenium + PhantomJS / GhostDriver作为subprocess

我有一个Node脚本,我想使用child_process模块来获取运行PhantomJS的GhostDriver的Selenium服务器。 我需要模块: Child = require "child_process" 以下是我如何尝试启动服务器并将GD附加到它(在Coffeescript中): @Selenium = new Child.exec "java -jar selenium/selenium-server-standalone-2.44.0.jar -role hub -port 4444", (error, stdout, stderr) => console.log stdout console.log error if error @PhantomJS = new Child.exec "phantomjs –webdriver=8080 –webdriver-selenium-grid-hub=http://127.0.0.1:4444", (error, stdout, stderr) => console.log stdout console.log error if error @PhantomJS的stdout是这样的: PhantomJS is launching GhostDriver… [ERROR – 2014-12-10T18:51:27.587Z] GhostDriver – […]

使用WebdriverJS禁用GhostDriver,PhantomJS的控制台日志

我一直在试图找出如何禁用令人讨厌的控制台日志,当我们用webdriverjs运行phantomjs(鬼驱动程序),但徒劳无功。 [INFO – 2016-10-09T14:57:15.039Z] GhostDriver – Main – running on port 62381 [INFO – 2016-10-09T14:57:15.084Z] Session [aa75cc80-8e30-11e6-8da5-a561819d4151] – page.settings – {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1","webSecurityEnabled":true} [INFO – 2016-10-09T14:57:15.084Z] Session [aa75cc80-8e30-11e6-8da5-a561819d4151] – page.customHeaders: – {} [INFO – 2016-10-09T14:57:15.084Z] Session [aa75cc80-8e30-11e6-8da5-a561819d4151] – Session.negotiatedCapabilities – {"browserName":"phantomjs","version":"2.1.1","driverName":"ghostdriver","driverVersion":"1.2.0","platform":"mac-10.10 (Yosemite)-64bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}} [INFO – 2016-10-09T14:57:15.084Z] SessionManagerReqHand […]

我可以/我怎么能将一个Selenium webdrivertesting脚本从node.js转换为phantomjs – ghostdriver?

我最近开始和Selenium一起工作,为了让生活更轻松,我开始使用节点来运行我的脚本,以便可以直观地监视testing。 我现在面临的挑战是将其转换为可以作为无头testing运行。 不幸的是,我所遇到的大部分资源只能用Java或Python使用phantomjs和ghostdriver。 我的老板要我通过没有Java或Python的phantomjs来运行testing。 最终,这些testing将通过不带GUI的服务器上的Linux VM远程运行。 目前,我正在使用Mac OS X 10.8进行testing,并且仍然有很多桥接以便达到我的目标。 我最重要的问题是,是否可以通过端口从phantomjs运行脚本而不使用Java或Python? 我花了好几个小时的时间仔细研究了我所能得到的资源,而且我没有find解决办法。 如果是这样,我该如何正确地初始化testing运行无头? 这是我如何编写我的functiontesting的开始。 我想正确地将function从firefox切换到phantomjs,并且能够使用合适的端口来运行它。 其余的testing导航到一个特定的网站,通过一个小部件login,然后进一步导航到该地区,我将build立进一步的testing,在我得到这个工作后操纵。 var webdriver = require('selenium-webdriver'), SeleniumServer = require('selenium-webdriver/remote').SeleniumServer; var server = new SeleniumServer("Path/selenium-server-standalone-2.39.0.jar", { port: 8910 }); server.start(); var driver = new webdriver.Builder(). usingServer(server.address()). withCapabilities(webdriver.Capabilities.firefox()). build(); testing工作完美,但我是新来的,所以我可以忽略一些愚蠢的东西。 请让我知道做了什么调整,以便通过幻影无法运行。 当我尝试使用节点运行脚本后切换functionphantomjs它产生的 "/Selenium/node_modules/selenium-webdriver/phantomjs.js:22 LogLevel = webdriver.logging.LevelName, ^ TypeError: Cannot read property 'LevelName' of […]