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

// //让数据;

})

})

我要下载的数据在此文本框中(见图片

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)