簡體   English   中英

Cypress Page Object Model 問題:運行鏈接到 PageObject 的測試時出現錯誤消息

[英]Cypress Page Object Model Issue:Got an error message when I ran a test linked to PageObject

問題:運行以下代碼時,我在 cypress 中收到錯誤消息。 錯誤消息“_HomePage.default.getNameBox 不是函數”

代碼: 在此處輸入圖像描述

在此處輸入圖像描述

[![enter image description here][1]][1]
 

您只是在變量名中使用大寫字母有一些問題。

而不是這個

const Homepage = new HomePage();    // Homepage is the instance
HomePage.getNameBox()               // uses the class not the instance

慣例是在實例的開頭使用一個小字符

const homePage = new HomePage();
homePage.getNameBox()               // uses the instance

暫無
暫無

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

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