我想在没有任何框架的情况下使用TestCafe与ag-Grid数据进行交互,有什么方法吗?
任何帮助都将不胜感激。
提前谢谢。
发布于 2020-09-09 15:42:44
我检查了the ag-Grid demo page,它在TestCafe上工作正常:
import { Selector } from 'testcafe';
fixture `Fixture`
    .page `https://www.ag-grid.com/example.php`;
test('test', async t => {
    const filterInput       = Selector('#myGrid > div > div.ag-root-wrapper-body.ag-layout-normal.ag-focus-managed > div.ag-root.ag-unselectable.ag-layout-normal > div.ag-header.ag-focus-managed.ag-pivot-off > div.ag-header-viewport > div > div.ag-header-row.ag-header-row-floating-filter > div:nth-child(1) > div.ag-floating-filter-body > div > input');
    const selectAllCheckbox = Selector('#ag-input-id-63');
    const cellTonySmith     = Selector('#myGrid').find('span').withText('Tony Smith');
    const checkboxTonySmith = cellTonySmith.parent().child(1);
    const cellTonyGunner     = Selector('#myGrid').find('span').withText('Tony Gunner');
    const checkboxTonyGunner = cellTonyGunner.parent().child(1);
    await t
        .typeText(filterInput, 'Tony')
        .hover(cellTonySmith)
        .click(checkboxTonySmith)
        .hover(cellTonyGunner)
        .click(checkboxTonyGunner);
    await t
        .debug();
});更新
我想点击属于英语的名字
import { Selector } from 'testcafe';
fixture `Fixture`
    .page `https://www.ag-grid.com/example.php`;
test('test', async t => {
    const englishCells = Selector('div').withAttribute('col-id', 'language').withText('English');
    const firstEnglishCell              = englishCells.nth(0);
    const nameRelatedToFirstEnglishCell = firstEnglishCell.parent().child(0).child(0).child(-1);
    const secondEnglishCell              = englishCells.nth(1);
    const nameRelatedToSecondEnglishCell = secondEnglishCell.parent().child(0).child(0).child(-1);
    await t
        .click(nameRelatedToFirstEnglishCell)
        .click(nameRelatedToSecondEnglishCell)
        .debug();
});https://stackoverflow.com/questions/63799051
复制相似问题