-1

I am trying to click on 'Exhibitor Access' showing in screenshot, Test Runner is showing 'click' action, but click is not happening at all, Check screenshot.

enter image description here

Please Can someone help me out on this, as I am stuck, I am using following strategy for this:

cy.get('a').eq(0).realClick()

As you may check in Test Runner, click is happening, but it is not navigating anywhere. enter image description here

Taimoor Pasha
  • 192
  • 2
  • 3
  • 16

1 Answers1

2

It looks like the click happens too soon (Cypress shows partial page).

Perhaps add a check for some text,

cy.contains('Please select which exhibiter booth you want to process')
cy.contains('a', 'Exhibitor Access').realClick()
Michael Hines
  • 928
  • 1
  • 7
  • No Mihi, I want to click on 'Exhibitor Access' button only. Thats it. – Taimoor Pasha Sep 13 '21 at 21:46
  • Why? You must ensure that your page will not be loaded. It makes no sense. – Michael Hines Sep 13 '21 at 21:48
  • before that clicking action, I am using wait(6000), and I think it is quite enough, also this is just one case, there is a case, where user have no exhibitor booths, what will i do then? – Taimoor Pasha Sep 13 '21 at 22:05
  • What will you do? That depends on what the page looks like in that state - provide that info, can answer that question. – Michael Hines Sep 13 '21 at 22:14
  • And so 6 seconds wait but Cypress still does not see the full page? How can it be enough time? Is there something blocking the page load. You should be trying things instead of finding reasons why it cannot work. – Michael Hines Sep 13 '21 at 22:16
  • Ok, I got it.. Its intend behaviour. Right now, what happening is that after login , network is showing me 401 i.e. 'Unauthorized error', which is not showing any products down there. – Taimoor Pasha Sep 13 '21 at 22:28
  • 1
    See [prior question](https://stackoverflow.com/a/69066845/16864887), use `cy.session()` to maintain login status. – Michael Hines Sep 13 '21 at 22:36