gpt4 book ai didi

javascript - 无法点击元素

转载 作者:行者123 更新时间:2023-12-04 13:53:56 26 4
gpt4 key购买 nike

<div class="MuiGrid-root jss48321 MuiGrid-item MuiGrid-grid-xs-12 MuiGrid-grid-sm-3 MuiGrid-grid-md-3 MuiGrid-grid-lg-3 MuiGrid-grid-xl-3">
<h4 class="MuiTypography-root jss48324 MuiTypography-h4">Decks</h4>
<button class="MuiButtonBase-root MuiFab-root jss48323 MuiFab-sizeSmall MuiFab-primary" tabindex="0" type="button" aria-label="add" title="Add">
<span class="MuiFab-label">
<svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24" aria-hidden="true">
<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path>
</svg>
</span>
<span class="MuiTouchRipple-root"></span>
</button></div>
由于它是react js应用程序,我补充说
browser.waitForAngularEnabled(false); 
在这里我想点击添加图标(+)
我的测试脚本。
element(by.css('svg[class="MuiSvgIcon-root"]')).click();
输出:失败:使用定位器找不到元素: By(css selector, svg[class="MuiSvgIcon-root"])任何人都可以帮助我解决这个问题。

最佳答案

尝试这个

it('test case', async () => {
let plusIcon = element(by.css('svg[class="MuiSvgIcon-root"]'))
await browser.waitForAngularEnabled(false);
// your steps prior to click
await browser.wait(
ExpectedConditions.presenseOf(plusIcon),
15000
);
await plusIcon.click();
});

关于javascript - 无法点击元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66149644/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com