Tag: webdriver io

WebdriverIO:如何正确迭代throus元素并注销getText?

我想学习webdriverio。 我尝试运行这个代码: client.init(). url('https://www.example.com'). elements('p').then((result) => { for (i = 0; i < result.value.length; i++) { (client.elementIdText(result.value[i])). then((re) => console.log(re)) } }) 但是没有注销。 我知道我可以使用getText('p')来做到这一点,但只是想知道如何使用元素('p')来做到这一点。

asynchronous函数依赖于量angular器testing中的外部模块

我要 保存在远程Web服务器中的图像文件 ,以及 将其上传到另一台服务器 在量angular器testing。 // depend on a external module var fs = require('fs'); // save remote file(url) to local(dest) var download = function (url, dest) { // let this function be async browser.executeAsyncScript(function (url, dest, done) { var file = fs.createWriteStream(dest); var request = http.get(url, function (response) { response.pipe(file); file.on('finish', function () { […]

在webdriverio中执行asynchronousfunction

我坚持这个问题,因为我是新的webdriverio 。 我的要求是我有一个页面,其中包含项目列表(如button等),我需要逐一点击每个项目。 但是,点击每个项目后,它将redirect到另一个部分/页面。 还有一个“closuresbutton”返回第一页(其中包含项目列表)。 我的实际需求是webdriverclient必须点击button,它将转到受尊敬的页面,然后单击“closuresbutton”并回滚,然后单击第一个button,它将继续,直到所有的button完成(我在这里使用'asynchronous'模块) 守则在这里.. var webdriverio = require('webdriverio'); var async = require("async"); var options = { desiredCapabilities: { browserName: 'chrome' } }; var client = webdriverio.remote(options); client .init() .url('pagelink') .elements('li', function (err, res) { if (err) { console.log(err); } else { var i = res.value.length; async.each(res.value, function (oneResult, callback) { console.log('i value […]

如何在另一个webdriver实例中重用现有的浏览器会话

正如问题所述 – 是否可以跨多个示例(即跨不同的浏览器会话)使用单个浏览器实例? 场景:在运行一堆seleniumtesting时,如果代码由于某种原因停止,则会重新启动代码,整个过程再次开始。 相反,如果会话可以被重用(甚至在初始化它的程序closures之后),那么我可以从停止的地方开始testing!

如何在UI自动化中捕获响应数据

我正在使用WebDriverIO的UI自动化,我正在尝试自动login页面。 当我点击Loginbutton时, *.com/user/login请求会在后台触发。 在这里,我想捕获*.com/user/login调用响应,因为我必须从响应中获取令牌才能继续下一个testing用例。 谁能帮帮我吗? 提前致谢!

nodejs selenium webdriverio webdriver.key(ENTER)

在没有susscess的情况下提出这个问题之前,我已经尽力search这个。 我只需要知道如何发送特殊字符(input密钥,退格等)与nodejs(webdriverio)selenium。 与python我需要导入selenium.keys,然后做Keys.ENTER,但我不知道如何处理JavaScript。 我的脚本已经完成并正在工作,除了需要按下input点以外,我无法find方法。 我曾尝试过 driver.click("#X20").then(function(res){ driver.keys(driver.Key.RETURN); driver.sendKeys(driver.Key.RETURN); ///and (just testing) }) 它没有工作:(

错误:对象不是用于将数组返回给我的callback函数的函数

我正在从智能行读取表格值。我通过单击每一行读取每个值来读取表格。 exports.getTableData = function(callback){ var uiArray =[]; var count; aLib.loadCheck(client); //Clicks the first record of the table aLib.controlClick(client, obj.table.firstRecord); aLib.loadCheck(client); // Gets the text of the total number of records on the top left of the table and uses it to drive the loop client.getText(obj.topContent.recordCount, function (err, rowNum){ console.log(rowNum); count = rowNum.match(/\d/g).join(""); console.log('No. of records […]

WebdriverJS是一个全function的替代原来的seleniumwebdriver

我正在寻找一个基于Java脚本的Web自动化框架,并遇到WebdriverJS 在主页上说下面。 ✔提供超过50个有用的操作来处理您的应用程序 ✔支持云中的seleniumtesting ✔兼容所有的NodeJStesting框架 它并没有真正的说,它是如何站在相比,原来的seleniumwebdriver的全部function,像这样的问题 – 是所有的seleniumapis映射呢 如果我决定使用它而不是seleniumwebdriver,我会怎么想? 与selenium或任何其他networking自动化框架的任何其他比较 注意:我不是从云testing的angular度来看,只需要一个工具,我可以在我的桌面使用自动化一些基于HTML的网站的testing用例

Webdriverio黄瓜不能使用承诺

我试图用webdriverIO学习更多的cucumberjs,并且在启动testing时遇到一些麻烦。 其实我想涵盖这个简单的function: Feature: Example Feature In order to become productive As a test automation engineer I want to understand the basics of cucumber Scenario: My First Test Scenario Given I have open "https://google.com" Then the title should be "Google". And the bar should be empty. 有了这个testing: const assert = require('assert'); module.exports = function() { this.Given(/^I […]

wedriverio jenkins – npm命令未find错误

我试图从jenkins运行webdriveriotesting,并按照此 。 我为jenkins安装了nodeJS插件,并在全局工具configuration下为NodeJS添加了名称和安装目录,名称为/usr/local/bin (节点可执行文件位于此文件夹中) 在jenkins,在项目configuration,在构build环境下,我已经检查 Provide Node & npm bin/ folder to PATH并从上一步中select节点安装名称 但是当我试图运行npm install npm test ,通过在Build下的execute shell下添加这些命令并构build它,我收到这个错误 Building in workspace /Users/Shared/Jenkins/Home/workspace/wdio-project [wdio-project] $ /bin/sh -xe /Users/Shared/Jenkins/tmp/hudson1478028169114509075.sh + npm install /Users/Shared/Jenkins/tmp/hudson1478028169114509075.sh: line 2: npm: command not found Build step 'Execute shell' marked build as failure Finished: FAILURE