如何解决Spectron从动态文本框中获取文本数据
所以我下载了一个使用电子框架的应用程序。
我设法单击所有需要的按钮来生成一些与服务器相关的数据。
此测试运行大约2分钟,并在此时间范围内随文本框一起生成文本。
不幸的是,我无法访问此数据,因为它找不到它的路径。
有什么办法吗?
附有该应用程序及其HTML代码的屏幕截图。
其他人,这是我的代码:
const Application = require('spectron').Application
const assert = require('assert')
const log = require('electron-log');
const {describe} = require('mocha')
const electronPath = require('electron')
const logger = require("electron-packager"); // Require Electron from
the binaries included in node_modules.
describe('Application launch',async function () {
this.timeout(10000)
beforeEach(async function () {
this.app = new Application({
path: '/Applications/fido-conformance-tools-electron.app`/Contents/MacOS/fido-conformance-tools-electron',`
})
return this.app.start();
})
afterEach(async function () {
// if (this.app && this.app.isRunning()) {
// return this.app.stop()
// }
})
it('shows an initial window',async function () {
await this.app.client.element(`//span[contains(text(),'Server Tests')]`).click();
await this.app.client.element(`[data-key='serverURL']`).click();
await this.app.client.element(`[data-key='serverURL']`).setValue('abcd.com');
await this.app.client.click("//a[@data-upgraded=',MaterialButton,MaterialRipple' and contains(text(),'Run')]");
await this.app.client.waitUntilTextExists('.passes a','passes',20000)
// require('electron').remote.getGlobal('setTimeout')(() => { console.log('done'); },2000);
// let isDisplayed = await (await this.app.client.$("[class=suite]:nth-of-type(1) li[class='test pass fast'] h2").waitForDisplayed());
const data = await this.app.client.getText("[class=suite]:nth-of-type(1) li[class='test pass fast'] h2");
// const data = await this.app.client.getText("[class='fido-tool-title']")
log.info(data);
// this.driver
// //让数据;
})
})
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。