Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeception Acceptance Test Fails Because of Bottom Navigation

I have a problem with one of my tests using codeception when I try to click a link, the window scrolls, to where the browser thinks it's supposed to go, however, my site has a navigation bar attached to the bottom of the window so when the browser stops scrolling, the bottom nav is covering the link.

Because of that, the test fails. Would anyone know how to configure it to scroll a little farther? Using Codeception 1.8.5.

Thanks

like image 616
Nemesis02 Avatar asked May 04 '14 15:05

Nemesis02


2 Answers

Update: Now you can also use the scrollTo() method, with the same argument you're passing into click():

$I->scrollTo($button);
$I->click($button);

See http://codeception.com/docs/modules/WebDriver#scrollTo

like image 125
Thomas Landauer Avatar answered Nov 14 '22 13:11

Thomas Landauer


Had the same problem, and albeit not a solution, a workaround is to scroll the window manually to somewhere where the link is visible (adapt Y below):

 $I->executeJS('window.scrollTo(0,Y);');

Source: How can I scroll a web page using selenium webdriver in python? (Adapted for Codeception)

like image 4
Motin Avatar answered Nov 14 '22 13:11

Motin