V
V
Vasily Koryak2015-07-24 16:54:30
PHP
Vasily Koryak, 2015-07-24 16:54:30

How to click on td content in codeception?

How to click on the contents of a cell inside a table using codeception.
The content of the table is as follows.

<table class="table table-striped table-hover table-bordered table-with-last-trtd" id="models_table">
  <thead>
    ...
  </thead>
  <tbody>
  <tr data-key="2" rel="tr_test_rel">
    <td class="td-name">Test Name</td>
    <td class="td-id_category_place">1</td>
    <td style="" class="td-actions">
      <a title="Обновитьid_1" href="?r=base/update&amp;modul=places&amp;id=2" class="edit">
      <i class="fa fa-pencil fa-2x"></i></a>
      <a data-pjax="0" data-confirm="Уверены в удалении?" data-path="?gggg=121" data-method="post" title="Удалить" href="/!admin/index.php?r=base%2Fdelete&amp;id=2&amp;modul=places" class="delete">
      <i class="fa fa-times-circle-o fa-2x"></i></a>
      <a data-add="fa-eye-slash" data-remove="fa-eye" title="Видимость раздела" href="?r=base/visible&amp;id=2&amp;modul=places" class="action has2status">
        <span class="fa fa-eye fa-2x"></span></a></td></tr>
    ...
  </tbody>
</table>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Koryak, 2015-07-27
@quaZZy

Is the corresponding method click?
I know it exists and all previous tests have been written using this method.
I'll bring some clarity

<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('Click on td');
$I->amOnPage('/?r=base/index&modul=devices');
$I->seeResponseCodeIs(200);
$I->click('...');
$I->seeElement('.fa-eye-slash')

?>

For example in js this click is handled like this
$('body').on('click', '.has2status', function(){
...
        });

But when I use the following selector, absolutely nothing happens
$I->click('.has2status');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question