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

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

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

StringGrid issue in Delphi XE8 firemonkey mobile app -