Tag: selenium

jasmine_node运行平均种子失败

运行由yeoman生成器生成的名为mean-seed的项目时遇到问题。 我一直在修补它几天,并尝试了一些事情。 我遇到麻烦的地方是运行“jasmine_node”任务: Running "jasmine_node" task >> Error: Unable to access jarfile node_modules/protractor/selenium/selenium-server-standalone-2.39.0.jar Warning: Done, with errors. Use –force to continue. Aborted due to warnings. 所以我第一次尝试识别缺less的npm包来安装 744 npm install && bower update && bower install 755 npm install protractor 760 npm install npm install selenium-standalone 761 npm install -g protractor 765 npm install protractor-tester 767 […]

nodejs中的selenium-webdriver不返回当前标题

我正在通过selenium驱动程序的例子,它没有工作。 几个月前,它工作得很好,所以我想知道如果我做错了什么,或者如果testing方法已经改变。 var assert = require('assert'), test = require('selenium-webdriver/testing'), webdriver = require('selenium-webdriver'); var By = webdriver.By; test.describe('Google Search', function() { test.it('should work', function(done) { var driver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.chrome()). build(); driver.get("http://www.google.com"); driver.findElement(By.name("q")).sendKeys("webdriver"); driver.findElement(By.name("btnG")).click(); driver.getTitle().then(function(title) { assert.equal("webdriver – Google Search", title); done(); }); driver.quit(); }); }); 输出是: AssertionError: "webdriver – Google Search" == "Google" Expected […]

WebDriverJs的getPageSource给了我一个对象,而不是页面的源代码

当我尝试显示页面的源时, res.json返回空白。 Selenium日志显示源代码已被检索。 任何想法如何才能正确接收更新的页面源代码? 它返回相同的东西,如果我使用其他function,如获取当前url。 码: var driver = new webdriver.Builder().usingServer('http://localhost:4444/wd/hub').withCapabilities(webdriver.Capabilities.firefox()).build(); driver.get('http://www.google.com'); var source = driver.getPageSource(); console.log(source); res.json({ message: source }); console.log输出: [{ then: [Function: then], cancel: [Function: cancel], isPending: [Function: isPending] } selenium日志: 16:17:30.273 INFO – Executing: [new session: Capabilities [{browserName=firefox}]]) 16:17:30.286 INFO – Creating a new session for Capabilities [{browserName=firefox}] 16:17:39.751 INFO – […]

黄瓜testing通过没有function存在

我已经开始为Cucumber创build一个Meteor应用程序的testing套件( http://joshowens.me/cucumber-js-and-meteor-the-why-and-how-of-it/ )。 一些testing通过时没有任何function。 例如,testing文件login.feature包含Feature: Allow users to login , Scenario: A user can login with valid information When I click on sign in link 它在文件loginSteps.js被支持: this.When(/^I click on sign in link$/, function (callback) { helper.world.browser. waitForExist('.at-signup', 7000). waitForVisible('.at-signup'). click('.at-signup'). call(callback); }); loginbutton实际上有class="btn btn-default navbar-btn" ,但Velocity说testing通过了858ms。 另一个testing通过url(helper.world.cucumber.mirror.rootUrl + "event/1")虽然没有这样的url。 其他testing失败,但是,如: getText('.user-menu .dropdown-top-level', function (err, username) […]

Webdriver(wd)testing在本地工作,但超时Travis CI?

我有一些testing用gulp-mocha-selenium写在引擎盖下使用wd。 注意这是“wd”驱动程序而不是vanilla Webdriver可能很重要。 testing在这里: https : //github.com/UWFosterIT/react-starter/blob/master/test/acceptance/hello-spec.js 我的travis.yml是: language: node_js node_js: – "0.10.37" before_install: – "export DISPLAY=:99.0" – "sh -e /etc/init.d/xvfb start" – "npm install -g eslint gulp eslint-plugin-react webpack" before_script: – "sleep 30" script: – "gulp check" – "gulp test:server" – "gulp test:acceptance" addons: firefox: "31" testing在当地正常工作,但在TravisCI.org上超时。 我不知道从哪里开始寻找。 特拉维斯的结果: https : //travis-ci.org/UWFosterIT/react-starter/builds/55222925

selenium独立与CORS

我目前正在通过nodejs与selenium独立使用webdriver io,这一切工作正常,直到我尝试做基于CORS的请求。 我目前使用Firefox作为testing浏览器,并且由于CORS请求到另一个域而引发错误。 服务器configuration为返回CORS的正确标题,XHR对象configuration为允许CORS。 我知道这些工作,因为当我手动使用该网站通过Firefox /铬的工作正常,但是当我testing它似乎炸毁了,这使我困惑,因为服务器和客户端configuration为CORS,并没有涉及当前testing的HTTPS。 那么为了让CORS在testing浏览器中工作,还有什么特别的事情要做吗? 我知道Selenium以自己的configuration文件启动浏览器,但是在configuration浏览器设置时找不到与cors有关的任何细节,也找不到与CORS实现相关的任何dependentFeatures。 如果能提供答案,我很乐意提供更多信息。

Windows上的Selenium WebDriver错误:找不到logging.js

我使用Selenium的WebDriverJS,通过JavaScript在Windows 8.1上自动化Chrome。 我下载了ChromeDriver和Selenium Standalone Server jar文件的副本,并放在E:\Selenium目录中。 我开始Selenium独立服务器,并试图运行我的JavaScript代码编写BrowserTest.js文件与节点命令提示符 E:\Selenium> Node BrowserTest.js BrowserTest.js : var driver = require("selenium-webdriver"); function createDriver() { var driver = new driver.Builder() .usingServer('http://localhost:4444/wd/hub') .withCapabilities(driver.Capabilities.chrome()) .build(); driver.manage().timeouts().setScriptTimeout(10000); return driver; } var driver = createDriver(); driver.get("http://www.google.com"); driver.getTitle().then(function (title) { console.log(title); }); driver.quit(); 但它会引发错误: fs.js:500 return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); ^ Error: ENOENT, no such file or […]

当用Grunt启动Nightwatch时,网站服务器未启动

我使用Nightwatch.js为网站运行系统testing。 我想通过grunt运行它们来自动化testing。 我的Gruntfile包含这些行: … var nightwatch = require('nightwatch'); nightwatch.initGrunt(grunt); … nightwatch: { options: { standalone: true, test_settings: { "default": { "launch_url": "http://localhost", "selenium_port": 4444, "selenium_host": "localhost", "silent": true, "screenshots": { "enabled": false, "path": "" }, "desiredCapabilities": { "browserName": "firefox", "javascriptEnabled": true, "acceptSslCerts": true } } }, "chrome" : { "desiredCapabilities": { "browserName": "chrome", "javascriptEnabled": true, […]

如何使用Selenium Webdriver Nodejs为一个configuration文件运行两个Chrome驱动程序?

我写testing,并为了速度,我想,该用户已被authentication(加载本地存储数据)。 import * as webdriver from 'selenium-webdriver'; import * as Chrome from 'selenium-webdriver/chrome'; var options = new Chrome.Options(); options.addArguments('–user-data-dir=C:\\profilepath'); var driver = new webdriver.Builder().withCapabilities(options.toCapabilities()).build(); driver.get("http://site.ru/").then(() => { console.log('Opened'); }, (err) => { console.log('Err', err); }); var driver2 = new webdriver.Builder().withCapabilities(options.toCapabilities()).build(); driver2.get("http://site.ru/").then(() => { console.log('Opened'); }, (err) => { console.log('Error', err); }); 第一个驱动程序工作正常,打开页面,第二个只是挂起初始屏幕没有任何错误。 同样的启动他们在不同的过程中…

使用selenium webdriverjs运行摩卡testing时不太有用的callstack

在使用JavaScript的selenium webdriver在mocha中运行testing时,调用堆栈并不是很有帮助。 作为一个简单的例子,我使用了以下简单的testing脚本test.js : var webdriver = require('selenium-webdriver'), test = require('selenium-webdriver/testing'); const TIMEOUT = 30000; test.describe('selenium webdriverjs', function () { var driver; this.timeout(TIMEOUT); test.before(function () { driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.firefox()).build(); driver.manage().timeouts().pageLoadTimeout(TIMEOUT); }); test.after(function () { driver.quit(); }); test.it('error stack', function () { driver.get('http://www.google.com'); driver.findElement(webdriver.By.id('doesnotexit')); }); }); (例如)从Gulp运行时,会生成以下错误堆栈: selenium webdriverjs 1) error stack 0 passing (4s) […]