【问题标题】:Is it possible to click on links(not buttons) inside a <form>?是否可以单击 <form> 内的链接(不是按钮)?
【发布时间】:2016-04-21 14:33:32
【问题描述】:

如果我有这样的事情:

<form>
<input type="submit" style="display: none;">
<a href="......">link</a> 
</form>

如何测试链接? 这有效:

$I->seeElement('//form/');

但为此我得到:

Element located either by name, CSS or XPath element with '//form/a' was not found.:
$I->seeElement('//form/a');

【问题讨论】:

    标签: xpath codeception


    【解决方案1】:

    如何测试链接?为清楚起见,假设您的链接的文本是“文本”。

    您可以点击以下链接: $I->click('文本'); 或者 $I->click(['link' => 'Text]);

    或者你可以看到链接 $I->seeElement(['link' => 'Text']); 或者 $I->canSeeElement(['link' => 'Text']);

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-07-18
      • 2014-08-13
      • 2011-01-10
      • 2015-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多