selenium webdriver - webdriverio Set getText string to variable -


i'm trying instantiate variable contents of gettext method using webdriverio.

  = string(browser.gettext('.field_notice')); 

when attempt print variable output:

[object object]

thanks help!

browser.gettext() asynchronous call need provide callback instantiate variable. try :

browser     .gettext('.field_notice').then(function(text) {         = text;     }); 

a similar example can found on webdriverio developer guide : http://webdriver.io/guide.html

also, there no need convert variable string since method returns string. see https://github.com/webdriverio/webdriverio/blob/master/lib/commands/gettext.js


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -