问题描述
问题: 当我运行以下代码时,我在 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