webdriver-io

webdriverio Set getText string to variable

a 夏天 提交于 2020-01-04 17:54:59
问题 I'm currently trying to instantiate a variable with the contents of the getText method using webdriverio. a = String(browser.getText('.field_notice')); When I attempt to print the variable this is the output: [object Object] Thanks for the help! 回答1: browser.getText() is an asynchronous call so you will need to provide a callback to instantiate your variable. Try this : browser .getText('.field_notice').then(function(text) { a = text; }); A similar example can be found on the Webdriverio

webdriverio Set getText string to variable

人走茶凉 提交于 2020-01-04 17:53:27
问题 I'm currently trying to instantiate a variable with the contents of the getText method using webdriverio. a = String(browser.getText('.field_notice')); When I attempt to print the variable this is the output: [object Object] Thanks for the help! 回答1: browser.getText() is an asynchronous call so you will need to provide a callback to instantiate your variable. Try this : browser .getText('.field_notice').then(function(text) { a = text; }); A similar example can be found on the Webdriverio

WebDriverIO Selenium pass command line arguments into Chrome from config.js file

喜夏-厌秋 提交于 2020-01-01 05:18:16
问题 I need chrome to run with disable-web-security flag for my UI tests. How can I inject any commands using wdio.config file (http://webdriver.io/). capabilities: [{ browserName: 'chrome' }] 回答1: You can set any chrome flags within the desired capabilities using chromeOptions capabilities: [{ browserName: 'chrome', chromeOptions: { args: ['disable-web-security'] } }] Check out the chromedriver docs for more information on the chromeOptions object. 回答2: This ended up being the correct syntax,

Pushing Test Names to Sauce Labs with CodeceptJS

♀尐吖头ヾ 提交于 2019-12-24 22:09:49
问题 I have been trying to get Sauce Labs to report the names of the tests that are being run with CodeceptJS, but so far I've only been able to report success/failure. I followed the following thread as a guide to help with reporting anything to Sauce Labs in general: https://github.com/Codeception/CodeceptJS/issues/371 The snippet I found is as follows: _after() { if (process.env.SAUCE_USERNAME) { var sessionId = this.helpers['WebDriverIO'].browser.requestHandler.sessionID; var sauce_url = "Test

WebDriverIO select using elements index

╄→尐↘猪︶ㄣ 提交于 2019-12-24 19:56:17
问题 I am using WebDriverIO to try to access (ie. getText, getAttribute, click, etc) an element after creating a list of elements. I am easily able to implement this element if I am using the browser.element() method, but the moment I use browser.elements() , I cannot access the individual objects in the array. According to the WebDriverIO docs, I should be able to access them using the value property. Here is my pseudo-code. I assumed that these two functions should return the same thing:

How/What is the best way to auto create/save text file version of automated test reporter logs

隐身守侯 提交于 2019-12-24 08:31:06
问题 It's my first time building proper selenium tests (I've touched on IDE before). I'm using Selenium with NodeJS, WebdriverIO, Mocha framework, wdio-spec-reporter and wdio-browserstack-service. I have managed to create my tests, suites specified in conf.js , hooked into browserstack (so when i run in command line, it creates a text log and video in browserstack). Now I've been asked to do something so that when a test/suite is run it will automatically save the text logs as a text file. My

Frame handling in Webdriver IO

做~自己de王妃 提交于 2019-12-24 03:45:12
问题 I am testing a webpage that has multiple forms in it. When I use client.frame({id:client.element('#frameId')}); I don't get any error, but when I try to interact with an element within that frame I get a RuntimeError telling me the element could not be located. I have been looking out for literature about how the frame() method works but I don't have any luck. 回答1: I was also using webdriver.io and it looks like documentation is a bit wrong. You can access frames: 1) via it's number on the

Selenium Chrome driver failed to parse value of getElementRegion

纵饮孤独 提交于 2019-12-23 18:36:50
问题 I get the following error from chrome driver when running my selenium tests with chrome driver. The test works fine with firefox. unknown error: failed to parse value of getElementRegion Here's the code, it fails when trying to click the submit button. I'm using selenium-standalone to run my server, specifying chromedriver with selenium-standalone start --drivers.chrome.version=2.8 and webdriverIO client .url(options.url) .setValue(usernameSelector, username) .setValue(passwordSelector,

Appium unable to start App on iPhone simulator

喜欢而已 提交于 2019-12-23 06:05:15
问题 My goal is to run some end 2 end smoke tests against an hybrid App built with Cordova. I am using Appium (driven by WebDriver.IO) and I can successfully spin up in an emulator the Android App and run the tests against it. I can't though even start the iOS App on the iPhone simulator. WebDriver.IO spits out this error: "ERROR: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: "Command 'Scripts

Running WebdriverIO 'spec' tests as node file

别说谁变了你拦得住时间么 提交于 2019-12-23 02:37:30
问题 I'm new to webdriverio. I don't understand how it's supposed to be configured and used within a node application. How do you run 'spec' tests when webdriverio is being imported? Can it be done? // based on http://webdriver.io/guide.html var webdriverio = require('webdriverio'); var options = { desiredCapabilities: { browserName: 'firefox' }, specs: './test/spec/**' // why doesn't this work, when it would work when run from the wdio cli }; webdriverio .remote(options) .init() .url('http://www