小编kyx*_*xap的帖子

量角器返回一个对象但是期望 - element.getText()的值

无法理解为什么它返回一个对象而不是文本值,一些测试代码:

describe('columns swap', function () {

    describe('location column ', function () {
        it('should swap right', function () {
            browser.sleep(10000);
            var fColumn = element(by.xpath('(//*[@class="k-link"])[2]')).getText();
            console.log(fColumn); 
Run Code Online (Sandbox Code Playgroud)

控制台输出:

>   columns swap
>     location column { ptor_:    { controlFlow: [Function],
>      schedule: [Function],
>      getSession: [Function],
>      getCapabilities: [Function],
>      quit: [Function],
>      actions: [Function],
>      executeScript: [Function],
>      executeAsyncScript: [Function],
>      call: [Function],
>      wait: [Function],
>      sleep: [Function],
>      getWindowHandle: [Function],
>      getAllWindowHandles: [Function],
>      getPageSource: [Function],
>      close: [Function],
>      getCurrentUrl: …
Run Code Online (Sandbox Code Playgroud)

javascript end-to-end promise selenium-webdriver protractor

8
推荐指数
1
解决办法
8475
查看次数