0
UIオートメーションプロジェクトでjsonファイルからデータを読み取ろうとしています。私はintern 4を使っています。 プロジェクトでPage Object Modelを実装しましたが、jsonファイルを使用してデータを渡そうとしています。私は他の同様の質問から解決策を試しましたが、うまくいかないようです。私のコードは、設定は次のとおりです。TypeScript(インターン4)でjsonファイルを読む方法は?
loginpage.ts
import {AdvalentBasePage} from "../BasePage";
import {DashboardPage} from "../dashboard/DashboardPage";
import * as LoginPageLocator from './LoginPageLocator.json'
export class LoginPage extends BasePage {
remote: any;
locator: any;
constructor(remote: any) {
super(remote, LoginPageLocator);
}
getPageTitleText(): string {
return "Login Page";
}
getPageTitleXpath(): string {
return this.locator.PageTitleXpath;
}
enterUsername(username: string) {
return this.remote.findByXpath(this.locator.userName).type(username);
}
enterPassword(password: string) {
return this.remote.findByXpath(this.locator.passwoed).type(password);
}
async clickSubmitBtn() {
var self = this;
await self.remote.findByXpath(self.locator.loginBtn).sleep(5000)
.click().end().sleep(5000);
var dashBoard: DashboardPage = new DashboardPage(self.remote);
return Promise.resolve(dashBoard);
}
}
が、その与えてエラーを次のように
src/pages/login/LoginPage.ts(3,35): error TS2307: Cannot find module './LoginPageLocator.json'.
をいくつかのいずれかが助けてください。
このファイルはすでに作成済みです。しかし、私はこのファイルをどこかに含めるべきですか?ちょうど作成は何も変更を加えなかったので、私は同じ記事を参照しました。 – CodeBlooded
あなたはそれが 'tsc'によって拾われていると確信していますか?たぶん、ノーそのTSCによってピックアップされていない、あなたのパターン –
からそれを除いたものがあります。 – CodeBlooded