簡體   English   中英

在量角器配置文件中設置onPrepare時不斷出現錯誤

[英]Keep getting an Error when setting up onPrepare in Protractor configuration file

我正在創建我的第一個量角器框架,並在配置文件中進行准備。

我一直收到錯誤X符號,但我不知道為什么。

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',


  specs: ['PageObjectLocator1.js'],

  capabilities: {
    browserName: 'chrome'
  }

  onPrepare = function {

    //place global functions here

  }


}

這也是一個屏幕截圖。

在此處輸入圖片說明

您在需要的地方遇到了語法問題:分隔鍵(onPrepare)和值(函數)。

另外,您在capabilitiesonPrepare鍵之間缺少逗號( , )。
這是您需要的代碼:

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['PageObjectLocator1.js'],
  capabilities: {
    browserName: 'chrome'
  },
  onPrepare: function() {
    //your code 
  }
}

onPrepare應該看起來像這樣

onPrepare: function() {
   //your code
}

而你的情況

exports.config = {
   seleniumAddress: 'http://localhost:4444/wd/hub',
   specs: ['PageObjectLocator1.js'],
   capabilities: { browserName: 'chrome' },  //don't forget the comma
   onPrepare: function() {
      //your code
   }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM