testcafe icon indicating copy to clipboard operation
testcafe copied to clipboard

The element that matches the specified selector is not visible - But button is visible

Open BinaryAlps opened this issue 8 years ago • 4 comments

Are you requesting a feature or reporting a bug?

Maybe a bug

What is the current behavior?

Cannot click a button that is in my site and do not gets manipulated at any time.

In the command line I get the following message shown: 2017_12_06 - testcafe error message on cmd

The test breaks after this message: 2017_12_06 - testcafe waiting for an element to appear

What is the expected behavior?

Button click should work like on all other pages I use for the tests.

How would you reproduce the current behavior (if this is a bug)?

It can not be reproduced, since on every other site the .click function works without any problems.

Provide the test code and the tested page URL (if applicable)

Tested page URL: -

Test code

const submitOrderBtn = Selector('button[type="submit"].btn-success');
//also tried with this:
//const submitOrderBtn = Selector('#confirmation-submit');
// and this:
//const submitOrderBtn = Selector('button').withText('order now');

const agbBtn = Selector("#conditions_accepted5");
const wiederrufsrechtBtn = Selector("#rescission_accepted6");

fixture `shop a product`
     .page `http://dev.local/checkout`;

test('complete order', async t =>{
     await t
          //some other actions for the process. Alle the stuff below is on the same page:
          .click(paymentSubmitBtn)
	  .click(agbBtn);
     console.log("[DEBUG], Trying to click submit button");
     await t
          .click(paymentSubmitBtn)
	  .click(agbBtn)
          .click(submitOrderBtn)

This is what the button looks in the html code:

<button id="confirmation-submit" type="submit" class="btn btn-success pull-right hidden-xs">
     <span class="glyphicon glyphicon-flag"></span>
     order now
</button>

Specify your

  • operating system: Windows 10
  • testcafe version: 0.8.15
  • node.js version: 8.9.0

BinaryAlps avatar Dec 06 '17 14:12 BinaryAlps

Hello @Hack4Life!

Unfortunately, it's hard to say something without the full page source code. If you concern about privacy, you can send a link/source through private messages on our forum: https://testcafe-discuss.devexpress.com/ to me, Helen Dikareva or Alexander Moskovkin.

If you can't share your code, could you please try to write minimal reproducible example, please?

TestCafe will consider element visibile if its width or height have a non-zero value, and it is not hided using CSS properties like display: hidden and visibility: none . You can check it in Computed CSS Properties in DevTools. In your case #confirmation-button might be an invisible button hidden somewhere in an actual visible element.

Also, you can try to resize browser window using resizeWindow action. It may help if your layout is adaptive or it is a scrolling issue.

AndreyBelym avatar Dec 06 '17 15:12 AndreyBelym

Thanks for your reply @AndreyBelym!

Your hint with resizeWindow helped me. I completely overlooked that another submit button is hidden on desktops and only visible on smaller devices. Since the first step in my tests is always .maximizeWindow() I have not thought that this could be the problem.

I will close this issue since it was just me overlooking a html piece of code.

BinaryAlps avatar Dec 07 '17 11:12 BinaryAlps

@Hack4Life Did you maximize the window again, after resizing it? or continued the test execution in the resized window?

Avinger27 avatar Apr 30 '18 06:04 Avinger27

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

lock[bot] avatar Mar 28 '19 14:03 lock[bot]