Mae*_*iha 1 javascript automated-tests github e2e-testing testcafe
I want to click the "Sign In" on the GitHub page for testcafe using javascript. From inspecting part I found that "Sign in" part has a class name. So I was trying to use "Selector" to select that particular class. But it is giving me this error. "The specified selector does not match any element in the DOM tree.
Selector('HeaderMenu-link no-underline mr-3').withText('Sign in')
Run Code Online (Sandbox Code Playgroud)
请检查以下测试,它成功为我单击了“登录”按钮:
import { Selector } from 'testcafe';
import { pick } from 'lodash';
fixture `GitHub`.page `github.com`;
test(`Click Sign In`, async t => {
await t.maximizeWindow();
await t.click(Selector('a.HeaderMenu-link').withText('Sign\u00a0in'));
await t.wait(3000);
});
Run Code Online (Sandbox Code Playgroud)
的 是,只能在HTML文档中使用的HTML控制序列。在普通的JS字符串中,用\u00a0字符表示。我同意这是相当晦涩的。我们将尝试在问题#3937的上下文中简化此类字符的处理
| 归档时间: |
|
| 查看次数: |
77 次 |
| 最近记录: |