设置:
问题4。
在单击任何“预订”时,它会将我重定向到登录页面,甚至是我最先登录的页面。
所有要求均在此处。
private function executeLogin(\AcceptanceTester $I)
{
$I->amOnPage('/de/account/login');
$I->fillField('#_username', 'user');
$I->fillField('#_password', 'somepw');
$I->click('body > div > main > div > form > div > div > button');
}
public function logIn(\AcceptanceTester $I )
{
$I->wantTo('Log-in to My Website');
$this->executeLogin($I);
}
public function goToBookings(\AcceptanceTester $I)
{
$I->wantTo('Go to all my Bookings Page');
$flyOutButton = '.nav-main__link-flyout.nav-account';
$myBookingsButton = '/html/body/div/header/div/div/div/nav/ul/li[2]/div/div/div/ul/li[3]/a';
$I->moveMouseOver($flyOutButton);
$I->moveMouseOver($myBookingsButton);
$I->click($myBookingsButton);
}
public function checkForExtra(\AcceptanceTester $I)
{
$I->wantTo('Go through all Bookings and check if Extras are Available');
$extrasCounter = 1;
do{
// $I->click('/html/body/div/main/div/div[2]/div['.$extrasCounter.']/a/div/article/div/div/div/button');
$I->click('/html/body/div/main/div/div[2]/div['.$extrasCounter.']/a');
//TODO Here it Redirects to the Login // Should go to the booking details Page
$grabExtrasID = $I->grabMultiple('#add-extras-link');
$totalExtras = count($grabExtrasID);
$extrasCounter++;
if ($totalExtras === 1){
break;
}
codecept_debug($totalExtras);
$I->moveBack();
}while($totalExtras == 0);
}
$I->Click
是我注销/重定向到登录名的地方。而不是整个预订详细信息页面。
控制台输出
I click "/html/body/div/main/div/div[2]/div[1]/a/div/article/div/div/div/button"
I grab multiple "#add-extras-link"
I move back
/de/account/bookings
0
I click "/html/body/div/main/div/div[2]/div[2]/a/div/article/div/div/div/button"
I grab multiple "#add-extras-link"
I move back
/de/account/bookings
0
I click "/html/body/div/main/div/div[2]/div[3]/a/div/article/div/div/div/button"
I grab multiple "#add-extras-link"
I move back
/de/account/bookings
0
I click "/html/body/div/main/div/div[2]/div[4]/a/div/article/div/div/div/button"
I grab multiple "#add-extras-link"
I move back
/de/account/bookings
0
I click "/html/body/div/main/div/div[2]/div[5]/a/div/article/div/div/div/button"
I grab multiple "#add-extras-link"
I move back
/de/account/bookings
0
如您所见,0表示它从我正在寻找的内容中找到了0个类。 该课程至少有3个预订。 这是因为它甚至都没有转到预订详细信息页面。
我希望这是有道理的,如果您需要其他信息,请告诉我。
谢谢。