Answer the question
In order to leave comments, you need to log in
How to get the included file variable in a class method?
You need to do a little automation in the browser. To do this, I need to connect the
index.php file with a request to the api to get the numbers of all invoices for which I need to make a newsletter.
In the index.php file, the variable $orderData
returns an array of numbers.
When the index.php file is included in a class method, the browser closes immediately, ignoring all subsequent wait calls.
<?php
class SigninCest
{
public function signIn(AcceptanceTester $I)
{
$I->amOnUrl(myUrl);
$I->fillField('username','user');
$I->fillField('passwd','password');
$I->click('.login-button');
$I->waitForElement('el', 5);
require_once 'index.php'; //браузер сразу закрывается
$arrNums = new moyscladQuery();
$arrNum = $arrNums->getQuery();
$I->fillField('text_search', $arrNum);
$I->wait(3);
}
}
class moyscladQuery
{
public function getQuery () {
//...api request
return $orderData;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question