Testing 如果页面有meta标记,如何使用Codeception进行测试?

Testing 如果页面有meta标记,如何使用Codeception进行测试?,testing,automated-tests,codeception,web-testing,webtest,Testing,Automated Tests,Codeception,Web Testing,Webtest,e、 g.确保: <meta name="robots" content="noindex" /> 页上不存在 $I->wantTo('Check that page can be indexed'); $I->amOnPage('/'); $I->dontSeeInPageSource('<meta name="robots" content="noindex" />'); $I->wantTo('Check that page can ind

e、 g.确保:

<meta name="robots" content="noindex" />

页上不存在

$I->wantTo('Check that page can be indexed');
$I->amOnPage('/');
$I->dontSeeInPageSource('<meta name="robots" content="noindex" />');
$I->wantTo('Check that page can index');
$I->amOnPage('/');
$I->dontSeeInPageSource(“”);
但它返回错误

调用未定义的方法WebGuy::DontSeInPagesource


要测试它没有标签,请执行以下操作:

$I->dontSeeElementInDOM('meta[name=robots]');
$I->seeElementInDOM('meta[name=robots]');
要测试它是否有标签,请执行以下操作:

$I->dontSeeElementInDOM('meta[name=robots]');
$I->seeElementInDOM('meta[name=robots]');

元元素永远不可见,因此无论元标记是否存在,此断言都将通过。