Tag: webdriver io

Selenium&webdriver.io如何使用executeScript?

我试图用Selenium,W​​ebDriver.io和Node.js(用Mocha)来testing一个简单的表单。 所以我有这样的东西: var webdriverio = require('webdriverio'); var expect = require('expect'); describe('Test form', function(){ beforeEach(function() { browser.url('/'); }); it('should save object', function() { expect(browser.executeScript('return window.data;')).to.be([]); }); afterEach(function() { if (this.currentTest.state !== "passed") { browser.saveScreenshot(); } }); }); 我的wdio.conf.js : var selenium = require('selenium-standalone'); var seleniumServer; exports.config = { host: '127.0.0.1', port: 4444, specs: [ 'test/*.spec.js' ], […]

如何使用WebdriverIO上传文件

我试图从WebdriverIO中将以下代码从selenium-webdriver gem移植到Node.js中: @webdriver.navigate.to "https://imgur.com/upload" element = @webdriver.find_element(:id, 'global-files-button') element.send_keys("C:\\test\\image.png") 正如你所看到的代码非常简单:导航到一个URL,findinput,设置文件path,并按预期工作selectfile upload。 这是我移植的版本: describe('User can upload', () => { it('select file', () => { browser.url("https://imgur.com/upload"); browser.waitForExist('#global-files-button'); $('#global-files-button').keys("C : \\ test \\ image . png".split(" ")); }); }); 不幸的是,这个testing没有设置path,我一直无法find一个像这样用wdio上传文件的工作示例,文档让我猜测。 任何build议非常感谢。 我知道都select文件和uploadFile,但我正在与云平台运行我的wdiotesting,他们似乎并不可靠的工作。

Fibers / Node-Gyp悬挂在纱线上

看起来像wdio纤维作为依赖,它使用node-gyp,显然不会在没有Python 2.7的Windows上运行。 现在,我已经安装了,我没有得到“失踪的PYTHON”错误,但它永远挂在任何命令正在做 – 纤维。

获取错误,而尝试运行seleniumwebdriver的示例testing

我试图在位于“\ node_modules \ selenium-webdriver \ example”的文件“google_search_test.js”中运行示例testing。 我正在使用webdriverjs,并且只在我的系统中安装了npm包“selenium-webdriver”。 我已经移动到命令提示符下的path位置并运行命令 node google_search_test.js 我收到如下错误, 错误说明: Path\node_modules\selenium-webdriver\example>node google_search_test.js Path\node_modules\selenium-webdriver\testing\index.js:184 exports.describe.skip = global.describe.skip; ^ TypeError: Cannot read property 'skip' of undefined at Object.<anonymous> (C:\Users\kanasra\Desktop\Jaguars\Automation Testing\N odeJs\node_modules\selenium-webdriver\testing\index.js:184:40) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (C:\Users\kanasra\Desktop\Jaguars\Automation Testing\N odeJs\node_modules\selenium-webdriver\example\google_search_test.js:24:12) at […]

Node.js Selenium IPv6问题(SocketException协议族不可用)

这个错误只发生在我产生的ios驱动程序 jar作为Node.js的孩子。 错误是java.net.SocketException: Protocol family unavailable seleniumtest.js: var spawn = require('child_process').spawn; var selenium = spawn('java', ['-jar', './ios-server-standalone-0.6.6-SNAPSHOT.jar', '-port', '4444']); selenium.stderr.setEncoding('utf8'); selenium.stderr.on('data', function (data){ console.log(data); }); webdriverjs-test.js( webdriverjs ) var webdriverjs = require('webdriverjs'); var options = { desiredCapabilities: { browserName: 'safari', platform: 'OS X 10.9', version: '7.1', device: 'iphone' } }; webdriverjs .remote(options) .init() .end(); 通过创build上述文件来重现此错误,在一个窗口中运行selenium-test.js,在另一个窗口中运行webdriverjs-test.js。 […]