-5

My register view:

<div class="datepicker-days" style="display: block;">

<table class=" table-condensed">
    <thead>
        <tr></tr>
        <tr></tr>
    </thead>
    <tbody>
        <tr>
            <td class="old disabled day"></td>
            <td class="old disabled day"></td>
            <td class="old disabled day"></td>
            <td class="disabled day"></td>
            <td class="day">
                2
            </td>

I worte this test:

$I->click(['class' => 'day'],'2');

and received this error:

Couldn't click {"class":"day"},"2": InvalidSelectorException: The given selector 2 is either invalid or does not result in a WebElement.

xlecoustillier
  • 16,183
  • 14
  • 60
  • 85

1 Answers1

0

I'd suggest using some selector like this

"(//td[contains(@class,'day') and not(contains(@class,'disabled'))])[1]"

This selector is using XPath - it matches any td element, which has 'day' string in its class atribute but doesn't contain any 'disabled' string.

The number in the end [1] is order of element selected, when multiple elements match the selector. Starting at 1 (not zero).