使用Appium运行Codecept时CodeceptJS locator.stringify不是函数错误

时间:2019-03-04 22:33:46

标签: codeceptjs

我有一个非常简单的脚本,其中我尝试使用Appium中的“ fillField”填充网站中的用户名字段,但出现此错误“ locator.stringify不是函数”。我无法找出问题所在。任何帮助表示赞赏。这是详细的输出-

[1] Starting recording promises
    Emitted | suite.before ([object Object])
  test something
    Emitted | test.before ([object Object])
    Emitted | test.start ([object Object])
    Emitted | step.before (I am on page "https://xxxxxxxxx.com/#login")
    Emitted | step.after (I am on page "https://xxxxxxxxx.com/#login")
    Emitted | step.before (I wait 6)
    Emitted | step.after (I wait 6)
    Emitted | step.before (I fill field "username", "hello@world.com")
    Emitted | step.after (I fill field "username", "hello@world.com")
    Emitted | step.start (I am on page "https://xxxxxxx.com/#login")
    I am on page "https://xxxxxxxxxxx.com/#login"
    Emitted | step.passed (I am on page "https://xxxxxxx.com/#login")
    Emitted | step.finish (I am on page "https://xxxxxxxx.com/#login")
    Emitted | step.start (I wait 6)
    I wait 6
    Emitted | step.passed (I wait 6)
    Emitted | step.finish (I wait 6)
    Emitted | step.start (I fill field "username", "hello@world.com")
    I fill field "username", "hello@world.com"
    [1] Error | TypeError: locator.stringify is not a function
    Emitted | step.failed (I fill field "username", "hello@world.com")
    Emitted | step.finish (I fill field "username", "hello@world.com")
    [1] Error | TypeError: locator.stringify is not a function
    [1] Starting <teardown> session
    Emitted | test.failed ([object Object])
    Emitted | test.finish ([object Object])
    [1] <teardown> Stopping recording promises
 › <screenshotOnFail> Test failed, saving screenshot
 › Screenshot has been saved to /Users/qa-engg/Documents/codeceptJS/appium/output/test_something.failed.png
  ✖ FAILED in 9740ms

    [2] Starting recording promises
    Emitted | test.after ([object Object])
    Emitted | suite.after ([object Object])

-- FAILURES:

  1) IP mobile
       test something:
     locator.stringify is not a function

2 个答案:

答案 0 :(得分:0)

您似乎发现了一个于2017年12月制造的错误。 很快,将解决问题。

作为解决方法,请使用不同的定位符,而不仅仅是字符串“ username”。 例如CSS,Xpath,严格定位器。

答案 1 :(得分:0)

@Evgeny-感谢您的回复。我终于能够将问题归结为webdriverio的安装。我既有全局安装,也有本地安装。我卸载了所有内容,然后进行了本地安装,这似乎已解决了该问题。