Javascript (已解决)使用TestCafe-如何阻止移动web智能应用标题出现?

Javascript (已解决)使用TestCafe-如何阻止移动web智能应用标题出现?,javascript,ios,testing,testcafe,smartbanner,Javascript,Ios,Testing,Testcafe,Smartbanner,我正在测试的网页显示了iOS设备上的Apple smart app横幅,使用HTML中的以下属性: name="apple-itunes-app" content="app-id=foobar" rel="manifest" href="/CompanyName/mobile/include/manifest.json" 但是,我不想显示这一点。通常,如果涉及到请求,我会使用TestCafe请求Mocker,但这个横幅似乎没有使用请求,它只是出现了! “网络”选项卡中没有清单请求 如何使用Te

我正在测试的网页显示了iOS设备上的Apple smart app横幅,使用HTML中的以下属性:

name="apple-itunes-app"
content="app-id=foobar"
rel="manifest"
href="/CompanyName/mobile/include/manifest.json"
但是,我不想显示这一点。通常,如果涉及到请求,我会使用TestCafe请求Mocker,但这个横幅似乎没有使用请求,它只是出现了! “网络”选项卡中没有清单请求

如何使用TestCafe本机功能或任何合适的节点包阻止smart app横幅

解决方案(感谢@Alex Kamaev帮助):

import { ClientFunction } from 'testcafe';

fixture `fixture`
    .page `http://localhost:8080`;

test.clientScripts({ content: `
    document.querySelector('meta[name="apple-itunes-app"]').remove();
` })(`test`, async t => {
    await t.wait(5000);
});

您可以尝试使用ClientScripts机制从页面中删除横幅元标记。有关详细信息,请参阅以下文章:

我准备了一个例子:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Math Ninja iPhone/iPod Touch Game | Making Addition, Subtraction, Multiplication, and Division Fun!</title>
    <meta name="apple-itunes-app" content="app-id=370144476"/>
    <link rel="stylesheet" type="text/css" href="reset.css"/>
    <link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
</body>
</html>

您可以尝试使用ClientScripts机制从页面中删除横幅元标记。有关详细信息,请参阅以下文章:

我准备了一个例子:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Math Ninja iPhone/iPod Touch Game | Making Addition, Subtraction, Multiplication, and Division Fun!</title>
    <meta name="apple-itunes-app" content="app-id=370144476"/>
    <link rel="stylesheet" type="text/css" href="reset.css"/>
    <link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
</body>
</html>

感谢@Alex,ClientScripts使用了:document.querySelector('meta[name=“apple itunes app”]”)。remove();感谢@Alex,ClientScripts使用了:document.querySelector('meta[name=“apple itunes app”]”)。remove();