, - :
$asserts = new \Codeception\Module\Asserts;
$foo = $I->executeInSelenium(function(\WebDriver $webdriver) {
return $webdriver->findElement(WebDriverBy::xpath('//*[@id="sidebar"]'))->getCSSValue('right');
});
codecept_debug( $foo );
$asserts->assertEquals( $foo, '-360px' );
$bar = $I->executeInSelenium(function(\WebDriver $webdriver) {
return $webdriver->findElement(WebDriverBy::cssSelector('#sidebar'))->getCSSValue('background-color');
});
codecept_debug( $bar );
$asserts->assertEquals( $bar, 'rgba(73, 73, 73, 1)' );
codecept_debug, /path/to/codecept run --debug, - , :
* I execute in selenium "lambda function"
-360px
* I execute in selenium "lambda function"
rgba(73, 73, 73, 1)
PASSED
Asserts ( acceptance.suite.yml ) - , :
OK (1 test, 2 assertions)
Logging:
, Selenium, , , .
17:19:02.236 INFO - Executing: [find element: By.xpath: //*[@id="sidebar"]])
17:19:02.243 INFO - Done: [find element: By.xpath: //*[@id="sidebar"]]
17:19:02.246 INFO - Executing: [get value of css property: 0 [[FirefoxDriver: firefox on MAC (64131329-819d-8f4a-8e11-bff91a410f13)] -> id: sidebar], right])
17:19:02.254 INFO - Done: [get value of css property: 0 [[FirefoxDriver: firefox on MAC (64131329-819d-8f4a-8e11-bff91a410f13)] -> id: sidebar], right]
17:19:02.325 INFO - Executing: [find element: By.selector: #sidebar])
17:19:02.334 INFO - Done: [find element: By.selector: #sidebar]
17:19:02.336 INFO - Executing: [get value of css property: 0 [[FirefoxDriver: firefox on MAC (64131329-819d-8f4a-8e11-bff91a410f13)] -> id: sidebar], background-color])
17:19:02.345 INFO - Done: [get value of css property: 0 [[FirefoxDriver: firefox on MAC (64131329-819d-8f4a-8e11-bff91a410f13)] -> id: sidebar], background-color]