The webpage I'm testing shows an Apple smart app banner on iOS devices, using the following attributes in the HTML:
name="apple-itunes-app"
content="app-id=foobar"
rel="manifest"
href="/CompanyName/mobile/include/manifest.json"
But, I do not want this to be displayed. Normally, I would use TestCafe Request Mocker if there was a request involved, but this banner does not seem to use a request, it just appears! There are no manifest requests in the Networks tab.
How can I block the smart app banner either with TestCafe native features or any suitable Node package?
Solution (thanks to @Alex Kamaev help):
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);
});
You can try to remove the banner meta tag from your page using the ClientScripts mechanism. Please refer to the following article to get details: https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/inject-scripts-into-tested-pages.html
I prepared an example:
Test code: