A WebDriver module for Codeception.
PHP 8.0
or higher.
composer require "codeception/module-webdriver" --dev
Codeception Module WebDriver
is open-sourced software licensed under the MIT License.
© Codeception PHP Testing Framework
WebDriver module for Codeception
License: MIT License
A WebDriver module for Codeception.
PHP 8.0
or higher.composer require "codeception/module-webdriver" --dev
Codeception Module WebDriver
is open-sourced software licensed under the MIT License.
© Codeception PHP Testing Framework
Automating application which accepts an SSL certificate before loading login page (2-way handshake)
Automated Firefox window is unable to fetch the SSL cert installed in browser and shows 400 error page
Provide console output if related. Use
-vvv
mode for more details.
20:05:57.153 INFO - Binding default provider to: org.openqa.selenium.chrome.ChromeDriverService
20:06:36.911 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.BeginSession@3f3ca0a7
20:06:36.913 INFO - /session: Executing POST on /session (handler: BeginSession)
20:06:36.917 INFO - Capabilities are: Capabilities {browserName=firefox}
20:06:36.918 INFO - Capabilities {browserName=firefox} matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService)
20:06:36.919 INFO - Capabilities {browserName=firefox} matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
1508942197058 geckodriver INFO geckodriver 0.18.0
1508942197078 geckodriver INFO Listening on 127.0.0.1:4823
1508942197559 geckodriver::marionette INFO Starting browser C:\Program Files (x86)\Mozilla Firefox\firefox.exe with args ["-marionette"]
1508942198172 addons.xpi WARN Error parsing extensions state: [Exception... "Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [amIAddonManagerStartup.readStartupData]" nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)" location: "JS frame :: resource://gre/modules/addo
ns/XPIProvider.jsm :: loadExtensionState :: line 1554" data: no] Stack trace: loadExtensionState()@resource://gre/modules/addons/XPIProvider.jsm:1554 < getInstallState()@resource://gre/modules/addons/XPIProvider.jsm:1589 < checkForChanges()@resource://gre/modules/addons/XPIProvider.jsm:3109 < start
up()@resource://gre/modules/addons/XPIProvider.jsm:2188 < callProvider()@resource://gre/modules/AddonManager.jsm:269 < _startProvider()@resource://gre/modules/AddonManager.jsm:739 < startup()@resource://gre/modules/AddonManager.jsm:906 < startup()@resource://gre/modules/AddonManager.jsm:3090 < obser
ve()@jar:file:///C:/Program%20Files%20(x86)/Mozilla%20Firefox/omni.ja!/components/addonManager.js:65
1508942199069 Marionette INFO Enabled via --marionette
[Child 11400] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
1508942202706 Marionette INFO Listening on port 24667
1508942202906 Marionette DEBUG Register listener.js for window 4294967297
20:06:42.981 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@4321fecd
20:06:42.981 INFO - Handler thread for session 33f7b7e9-c66b-4c63-9845-a6c7c12ec605 (firefox): Executing POST on /session/33f7b7e9-c66b-4c63-9845-a6c7c12ec605/url (handler: ServicedSession)
1508942203012 Marionette DEBUG Received DOM event "beforeunload" for "about:blank"
1508942204521 Marionette DEBUG Received DOM event "pagehide" for "about:blank"
1508942204522 Marionette DEBUG Received DOM event "unload" for "about:blank"
1508942204532 Marionette DEBUG Received DOM event "DOMContentLoaded" for "https://zeetraining.com/"
1508942204541 Marionette DEBUG Received DOM event "pageshow" for "https://zeetraining.com/"
20:06:45.112 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@4321fecd
20:06:45.113 INFO - Handler thread for session 33f7b7e9-c66b-4c63-9845-a6c7c12ec605 (firefox): Executing POST on /session/33f7b7e9-c66b-4c63-9845-a6c7c12ec605/elements (handler: ServicedSession)
20:06:45.636 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@4321fecd
20:06:45.636 INFO - Handler thread for session 33f7b7e9-c66b-4c63-9845-a6c7c12ec605 (firefox): Executing POST on /session/33f7b7e9-c66b-4c63-9845-a6c7c12ec605/elements (handler: ServicedSession)
20:06:45.666 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@4321fecd
20:06:45.667 INFO - Handler thread for session 33f7b7e9-c66b-4c63-9845-a6c7c12ec605 (firefox): Executing POST on /session/33f7b7e9-c66b-4c63-9845-a6c7c12ec605/elements (handler: ServicedSession)
20:06:45.705 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@4321fecd
20:06:45.705 INFO - Handler thread for session 33f7b7e9-c66b-4c63-9845-a6c7c12ec605 (firefox): Executing POST on /session/33f7b7e9-c66b-4c63-9845-a6c7c12ec605/elements (handler: ServicedSession)
20:06:45.740 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.GetLogTypes@d1229ec
20:06:45.741 INFO - /session/33f7b7e9-c66b-4c63-9845-a6c7c12ec605/log/types: Executing GET on /session/33f7b7e9-c66b-4c63-9845-a6c7c12ec605/log/types (handler: GetLogTypes)
20:06:45.758 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.GetLogsOfType@752db15f
20:06:45.759 INFO - /session/33f7b7e9-c66b-4c63-9845-a6c7c12ec605/log: Executing POST on /session/33f7b7e9-c66b-4c63-9845-a6c7c12ec605/log (handler: GetLogsOfType)
20:06:45.769 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@4321fecd
20:06:45.769 INFO - Handler thread for session 33f7b7e9-c66b-4c63-9845-a6c7c12ec605 (firefox): Executing GET on /session/33f7b7e9-c66b-4c63-9845-a6c7c12ec605/screenshot (handler: ServicedSession)
20:06:45.843 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@4321fecd
20:06:45.844 INFO - Handler thread for session 33f7b7e9-c66b-4c63-9845-a6c7c12ec605 (firefox): Executing GET on /session/33f7b7e9-c66b-4c63-9845-a6c7c12ec605/source (handler: ServicedSession)
20:06:45.922 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@4321fecd
20:06:45.922 INFO - Handler thread for session 33f7b7e9-c66b-4c63-9845-a6c7c12ec605 (firefox): Executing DELETE on /session/33f7b7e9-c66b-4c63-9845-a6c7c12ec605/cookie (handler: ServicedSession)
20:06:45.944 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@4321fecd
20:06:45.945 INFO - Handler thread for session 33f7b7e9-c66b-4c63-9845-a6c7c12ec605 (firefox): Executing DELETE on /session/33f7b7e9-c66b-4c63-9845-a6c7c12ec605 (handler: ServicedSession)
1508942205956 Marionette INFO New connections will no longer be accepted
[GFX1-]: Receive IPC close with reason=AbnormalShutdown
[GFX1-]: Receive IPC close with reason=AbnormalShutdown
20:06:46.656 INFO - Removing session org.openqa.selenium.remote.server.ServicedSession@4321fecd
Provide test source code if related
class FirstCest
{
// tests
public function checkLogin(AcceptanceTester $I)
{
$I->am('admin');
$I->wantTo('login to Training');
$I->amOnPage('/login');
$I->fillField("#email", "zeetrainingadmin");
$I->fillField("#password", "abc123");
$I->click('Login');
$I->see('Training');
}
}
composer show
)# paste suite config here
actor: AcceptanceTester
modules:
enabled:
- WebDriver:
url: https://zeetraining.com
browser: firefox
desiredCapabilities:
acceptSslCerts: false
acceptInsecureCerts: true
- \Helper\Acceptance
This is a suggestion after struggling to reset the host base, that needs resetting after the use of amOnUrl()
http://codeception.com/docs/modules/WebDriver#amonurl
My suggestion is the following:
Although, it can be written much better probably
public function resetHostBase(){
$config = \Codeception\Configuration::config();
$url = $config["modules"]["config"]["WebDriver"]["url"];
$this->amOnUrl($url);
}
I believe that this function is needed in many cases after the use of amOnUrl() when using the WebDriver.
Thank you!
I want to push url where test failed in standard html report
support/MyHelper.php I have this code:
public function _failed(TestInterface $test, $fail)
{
$url = $this->getModule('WebDriver')->_getCurrentUri();
//HOW TO DO HERE SOMETHING LIKE "$I->comment($url);"?
parent::_failed($test, $fail); // TODO: Change the autogenerated stub
}
So I want to include some analog of $I->comment($url_of_failed_test);
to push it in each failed test in html report. How to do it without make _failed function in each my test?
WebDriver::seeInSource()
and WebDriver::seeInPageSource()
both claim to do the same, but differ internally. Which one is the current/recommended? => Deprecate the other! (i.e. keep it as alias till v5.0, then remove it)
Given the following basic form structure:
<label for="title-1">Title</label>
<input id="title-1">
<div class="nested">
<label for="title-2">Title</label>
<input id="title-2">
</div>
The following snippet will always fill the first Title
field instead of the second one:
$I->performOn(
['class' => 'nested'],
ActionSequence::build()->fillField('Title', 'Test')
);
The reason for this is that WebDriver::fillField()
uses the internal WebDriver::findFields()
method and that one always uses $this->webDriver
(the RemoteWebDriver
instance) as base instead of WebDriver::getBaseElement()
.
I am trying to fill the field with a simple value.
The value is appended at the end of the current value.
The HTML5 element <summary>
is missing from the list of clickable elements at WebDriver::_findClickable()
I tried to add it there just like the others: ".//summary[normalize-space(.)=$locator]",
- but this doesn't really fix it, since there are many elements allowed inside <summary>
: https://html.spec.whatwg.org/#the-summary-element
I think this needs to be refactored, since (from looking at the code) elements inside <a>
are also not matched, e.g. <a href="..."><div>...</div></a>
- which is valid HTML 5: https://html.spec.whatwg.org/#the-a-element
So I guess the arguments that are thrown into Locator::combine()
need to be replaced by functions to allow more complex matching logic.
I have a Bootstrap custom radio button:
<div class="custom-control custom-radio">
<input type="radio" id="form_foo_0" name="form[foo]" value="Whatever" class="custom-control-input">
<label for="form_foo_0" class="radio-custom custom-control-label required">Whatever</label>
</div>
When I do this in an acceptance test:
$I->selectOption('input[name="form[foo]"]', 'Whatever:');
or
$I->click(['css' => '#form_foo_0']);
...I'm getting:
[Facebook\WebDriver\Exception\ElementClickInterceptedException] element click intercepted:
Element <input type="radio" id="form_foo_0" name="form[foo]" value="Whatever" class="custom-control-input"> is not clickable at point (44, 1171).
Other element would receive the click:
<label for="form_foo_0" class="radio-custom custom-control-label required">...</label>
(Session info: chrome=85.0.4183.83)
The workaround I'm using now is to click the label:
$I->click(['css' => 'label[for="form_foo_0"]']);
Due to the popularity of Bootstrap I'm wondering if an out-of-the-box solution would be better in this case.
P.S.: I don't know why I have the class radio-custom
on the <label>
- it's created by Symfony's Bootstrap form theme
To verify the page url by passing a FULL url with its protocol and domain.
E.g. $I->seeInCurrentUrl("http://www.test.com");
I already tried seeCurrentUrlEquals and seeInCurrentUrl, only the path after the domain was able to be verified.
Seems like this is an aggressive regex type deal, but having an html entity inlined inside a button causes an acceptance test fail. Doesn't seem to matter what the entity is. It seems a blank space is needed to cause the entity to be ignored.
// $i->click('sign-in');
// this fails...
<button type="submit">
<span class="fa fa-user"></span> sign-in
</button>
// this fails, variations...
<span class="fa fa-user"></span>sign-in
<span class="fa fa-user"> </span>sign-in
//...and this doesn't...
<span class="fa fa-user"></span>sign-in
<span class="fa fa-user"></span> sign-in
<span class="fa fa-user"></span>sign-in
No biggie, but was a bit of a surprise trying to figure out why the test failed.
Run codeception in Docker using standalone selenium server
[Error] Class name must be a valid object or a string
NOTE: Since the above seems to be an issue external to the tests (as I removed all the actuals tests--see PHP section below) I debugged through and found that the issue was happening within the foreach loop in \PhpUnit\TextUi\DefaultResultPrinter::printDefects() when it calls $this->printDefect()
.
In a dump of $defect
, I found the following:
[message] => Could not start a new session. Could not start a new session. Error while creating session with the driver service. Stopping driver service: Driver server process died prematurely.
Provide console output if related. Use
-vvv
mode for more details.
Codeception PHP Testing Framework v4.1.28
Powered by PHPUnit 9.5.12 by Sebastian Bergmann and contributors.
Acceptance Tests (1) -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
E LoginCest: Login page has form test (0.00s)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Time: 00:04.366, Memory: 10.00 MB
There was 1 error:
---------
1) LoginCest: Login page has form test
Test tests/acceptance/LoginCest.php:loginPageHasFormTest
[Error] Class name must be a valid object or a string
Artifacts:
Png: /var/www/app/tests/_output/acceptance.LoginCest.loginPageHasFormTest.fail.png
Html: /var/www/app/tests/_output/acceptance.LoginCest.loginPageHasFormTest.fail.html
ERRORS!
Tests: 1, Assertions: 0, Errors: 1.```
> Provide test source code if related
```php
<?php
namespace acceptance;
use AcceptanceTester;
use Codeception\Util\Locator;
class LoginCest
{
// removed the contents of the test to check that current issues have nothing to do with the test itself
public function loginPageHasFormTest(AcceptanceTester $I)
{
}
}
Contents of the output .html
/session//source
Codeception version: Codeception PHP Testing Framework v4.1.28
PHP Version: 7.4
Operating System: Mac Monterey v12.2.1
Installation type: Composer
List of installed packages (composer show
)
auth0/auth0-php 8.0.6 Auth0 PHP SDK. Straight-forward and tested methods for accessing Auth0 Authentication and Management API endpoints.
aws/aws-crt-php v1.0.2 AWS Common Runtime for PHP
aws/aws-sdk-php 3.209.10 AWS SDK for PHP - Use Amazon Web Services in your PHP project
behat/gherkin v4.9.0 Gherkin DSL parser for PHP
codeception/codeception 4.1.28 BDD-style testing framework
codeception/lib-asserts 2.0.0 Assertion methods used by Codeception core and Asserts module
codeception/lib-innerbrowser 2.0.2 Parent library for all Codeception framework modules and PhpBrowser
codeception/module-asserts 2.0.1 Codeception module containing various assertions
codeception/module-phpbrowser 2.0.2 Codeception module for testing web application over HTTP
codeception/module-rest 2.0.1 REST module for Codeception
codeception/module-webdriver 2.0.2 WebDriver module for Codeception
codeception/phpunit-wrapper 9.0.6 PHPUnit classes used by Codeception
codeception/stub 4.0.1 Flexible Stub wrapper for PHPUnit's Mock Builder
composer/pcre 1.0.1 PCRE wrapping library that offers type-safe preg_* replacements.
composer/semver 3.2.7 Semver library that offers utilities, version constraint parsing and validation.
composer/xdebug-handler 3.0.1 Restarts a process without Xdebug.
doctrine/annotations 1.13.2 Docblock Annotations Parser
doctrine/inflector 2.0.4 PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.
doctrine/instantiator 1.4.0 A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer 1.2.2 PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
drewm/mailchimp-api v2.5.4 Super-simple, minimum abstraction MailChimp API v3 wrapper
eftec/bladeone 4.2 The standalone version Blade Template Engine from Laravel in a single php file
elasticsearch/elasticsearch v5.5.0 PHP Client for Elasticsearch
friendsofphp/php-cs-fixer v3.5.0 A tool to automatically fix PHP code style
fzaninotto/faker v1.9.2 Faker is a PHP library that generates fake data for you.
graham-campbell/result-type v1.0.4 An Implementation Of The Result Type
guzzlehttp/guzzle 7.4.1 Guzzle is a PHP HTTP client library
guzzlehttp/promises 1.5.1 Guzzle promises library
guzzlehttp/psr7 2.1.0 PSR-7 message implementation that also provides common utility methods
guzzlehttp/ringphp 1.1.1 Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.
guzzlehttp/streams 3.0.0 Provides a simple abstraction over streams of data
hashids/hashids 2.0.4 Generate short, unique, non-sequential ids (like YouTube and Bitly) from numbers
hubspot/hubspot-php 4.0.1 HubSpot PHP API client
illuminate/bus v8.80.0 The Illuminate Bus package.
illuminate/collections v8.80.0 The Illuminate Collections package.
illuminate/container v8.80.0 The Illuminate Container package.
illuminate/contracts v8.80.0 The Illuminate Contracts package.
illuminate/database v8.80.0 The Illuminate Database package.
illuminate/events v8.80.0 The Illuminate Events package.
illuminate/macroable v8.80.0 The Illuminate Macroable package.
illuminate/pipeline v8.80.0 The Illuminate Pipeline package.
illuminate/support v8.80.0 The Illuminate Support package.
intervention/image 2.7.1 Image handling and manipulation library with support for Laravel integration
justinrainbow/json-schema 5.2.11 A library to validate a json schema.
kigkonsult/icalcreator v2.24.2 iCalcreator is the PHP implementation of rfc2445/rfc5545, management of iCal formatted files
kriswallsmith/buzz 1.2.0 Lightweight HTTP client
laravel/envoy v2.8.1 Elegant SSH tasks for PHP.
league/csv 8.2.3 Csv data manipulation made easy in PHP
monolog/monolog 1.26.1 Sends your logs to files, sockets, inboxes, databases and various web services
mtdowling/jmespath.php 2.6.1 Declaratively specify how to extract elements from a JSON document
myclabs/deep-copy 1.10.2 Create deep copies (clones) of your objects
nesbot/carbon 2.55.2 An API extension for DateTime that supports 281 different languages.
nikic/php-parser v4.13.2 A PHP parser written in PHP
nyholm/psr7 1.5.0 A fast PHP7 implementation of PSR-7
parsecsv/php-parsecsv 1.0.0 CSV data parser for PHP
phar-io/manifest 2.0.3 Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version 3.1.0 Library for handling version information and constraints
php-cs-fixer/diff v2.0.2 sebastian/diff v3 backport support for PHP 5.6+
php-http/discovery 1.14.1 Finds installed HTTPlug implementations and PSR-7 message factories
php-http/httplug 2.2.0 HTTPlug, the HTTP client abstraction for PHP
php-http/message-factory v1.0.2 Factory interfaces for PSR-7 HTTP Message
php-http/multipart-stream-builder 1.2.0 A builder class that help you create a multipart stream
php-http/promise 1.1.0 Promise used for asynchronous HTTP requests
php-webdriver/webdriver 1.12.0 A PHP client for Selenium WebDriver. Previously facebook/webdriver.
phpdocumentor/reflection-common 2.2.0 Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock 5.3.0 With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.
phpdocumentor/type-resolver 1.6.0 A PSR-5 based resolver of Class names, Types and Structural Element Names
phpfastcache/phpfastcache 6.1.5 PHP Cache Class - Reduce your database call using cache system. PhpFastCache handles a lot of drivers such as Apc(u), Cassandra, CouchBase, Couchdb, Mongodb, Files, (P)redis, Leveldb, Memcache(d), Ss...
phpoption/phpoption 1.8.1 Option Type for PHP
phpspec/prophecy v1.15.0 Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage 9.2.10 Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator 3.0.6 FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker 3.1.1 Invoke callables with a timeout
phpunit/php-text-template 2.0.4 Simple template engine.
phpunit/php-timer 5.0.3 Utility class for timing
phpunit/phpunit 9.5.12 The PHP Unit Testing framework.
psr/cache 1.0.1 Common interface for caching libraries
psr/container 1.1.2 Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher 1.0.0 Standard interfaces for event handling.
psr/http-client 1.0.1 Common interface for HTTP clients
psr/http-factory 1.0.1 Common interfaces for PSR-7 HTTP message factories
psr/http-message 1.0.1 Common interface for HTTP messages
psr/log 1.1.4 Common interface for logging libraries
psr/simple-cache 1.0.1 Common interfaces for simple caching
ralouphie/getallheaders 3.0.3 A polyfill for getallheaders.
react/promise v2.8.0 A lightweight implementation of CommonJS Promises/A for PHP
sebastian/cli-parser 1.0.1 Library for parsing CLI options
sebastian/code-unit 1.0.8 Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup 2.0.3 Looks up which function or method a line of code belongs to
sebastian/comparator 4.0.6 Provides the functionality to compare PHP values for equality
sebastian/complexity 2.0.2 Library for calculating the complexity of PHP code units
sebastian/diff 4.0.4 Diff implementation
sebastian/environment 5.1.3 Provides functionality to handle HHVM/PHP environments
sebastian/exporter 4.0.4 Provides the functionality to export PHP variables for visualization
sebastian/global-state 5.0.3 Snapshotting of global state
sebastian/lines-of-code 1.0.3 Library for counting the lines of code in PHP source code
sebastian/object-enumerator 4.0.4 Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector 2.0.4 Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context 4.0.4 Provides functionality to recursively process PHP variables
sebastian/resource-operations 3.0.3 Provides a list of PHP built-in functions that operate on resources
sebastian/type 2.3.4 Collection of value objects that represent the types of the PHP type system
sebastian/version 3.0.2 Library that helps with managing the version number of Git-hosted PHP projects
sendgrid/php-http-client 3.14.1 HTTP REST client, simplified for PHP
sendgrid/sendgrid 7.4.2 This library allows you to quickly and easily send emails through Twilio SendGrid using PHP.
setasign/fpdf 1.8.1 FPDF is a PHP class which allows to generate PDF files with pure PHP. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.
softcreatr/jsonpath 0.7.5 JSONPath implementation for parsing, searching and flattening arrays
squizlabs/php_codesniffer 3.6.2 PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.
symfony/browser-kit v5.4.3 Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically
symfony/console v5.4.2 Eases the creation of beautiful and testable command line interfaces
symfony/css-selector v5.4.2 Converts CSS selectors to XPath expressions
symfony/deprecation-contracts v2.5.0 A generic function and convention to trigger deprecation notices
symfony/dom-crawler v5.4.6 Eases DOM navigation for HTML and XML documents
symfony/event-dispatcher v5.4.0 Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/event-dispatcher-contracts v2.5.0 Generic abstractions related to dispatching event
symfony/filesystem v5.4.0 Provides basic utilities for the filesystem
symfony/finder v5.4.2 Finds files and directories via an intuitive fluent interface
symfony/options-resolver v5.4.0 Provides an improved replacement for the array_replace PHP function
symfony/polyfill-ctype v1.24.0 Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme v1.24.0 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-normalizer v1.24.0 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring v1.24.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php73 v1.24.0 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-php80 v1.24.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/polyfill-php81 v1.24.0 Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions
symfony/process v5.4.2 Executes commands in sub-processes
symfony/service-contracts v2.5.0 Generic abstractions related to writing services
symfony/stopwatch v5.4.0 Provides a way to profile code
symfony/string v5.4.2 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
symfony/translation v4.4.34 Provides tools to internationalize your application
symfony/translation-contracts v2.5.0 Generic abstractions related to translation
symfony/yaml v3.4.31 Symfony Yaml Component
theseer/tokenizer 1.2.1 A small library for converting tokenized PHP source code into XML and potentially other formats
twilio/sdk 5.42.2 A PHP wrapper for Twilio's API
vlucas/phpdotenv v5.4.1 Loads environment variables from .env
to getenv()
, $_ENV
and $_SERVER
automagically.
voku/portable-ascii 1.5.6 Portable ASCII library - performance optimized (ascii) string functions for php.
webmozart/assert 1.10.0 Assertions to validate method input/output with nice error messages.
wimg/php-compatibility 9.3.5 A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.
Suite configuration:
modules:
enabled:
- WebDriver:
url: http://127.0.0.1
browser: chrome
capabilities:
chromeOptions:
args: [ "--headless", "--disable-gpu" ]
Provide console output if related. Use
-vvv
mode for more details.
# paste output here
Provide test source code if related
// paste test
composer show
)# paste suite config here
Hey Guys,
Here https://codeception.com/docs/modules/WebDriver Codeception claims, that default timeouts (connection_timeout
and request_timeout
) are 30 seconds. Because of the bug, I think they are set to 0 now, which makes curl_exec() later to wait indefinitely.
Check this code https://github.com/Codeception/module-webdriver/blob/master/src/Codeception/Module/WebDriver.php#L362
$this->connectionTimeoutInMs = $this->config['connection_timeout'] * 1000;
$this->requestTimeoutInMs = $this->config['request_timeout'] * 1000;
by default both values are null
, but multipling null * 1000
results in 0
, not null
. Later here https://github.com/php-webdriver/php-webdriver/blob/main/lib/Remote/RemoteWebDriver.php#L101 it is strictly compared with null
, but since the value is 0
it passes the condition and sets timeout to 0
which makes curl to wait indefinitely.
Some suggestions/questions for seeInField
:
Even if not explicitly mentioned at http://codeception.com/docs/modules/WebDriver#seeInField it works for radio buttons too? And probably select's and checkbox'es too?
For radio buttons, you need to pass the value as second argument:
$I->seeInField('.gender', 1);
...which isn't very readable ;-) So I'm suggesting a method to assert a radio button's value by its label - something like:
$I->seeRadioSelected('.gender', 'female');
How can you assert that no radio button is selected? I tried seeInField
with null
or ''
as second argument - both didn't work. So I'm suggesting to include that too.
We are trying to click an element in a webpage.
Wrong element (the left or the right element) gets clicked instead. Based on the documentation here clickWithLeftButton
with offset should place the cursor on the upper left corner of the element, but with extensive testing, we've found out that the position of the cursor is actually at the center of the element. Note that we are writing acceptance tests for a web application. The same code works fine with Chrome (configuration below) but it does not work well with Selenium/Gecko/Firefox. We are using an RTL language (Persian) in UTF-8.
Part of the code that is failing :
$I->moveMouseOver($class,10,10);
$I->wait(1);
$I->clickWithLeftButton($class,10,10);
Codeception : 4
PHP : 7.2 Remi
Selenium : 3.8.1 with enablePassThrough function
Geckodriver : 0.26.0
Mozilla Firefox : 72.0.1
OS : Windows 10
acceptance.suite.yml:
# Codeception Test Suite Configuration
#
# Suite for acceptance tests.
# Perform tests in browser using the WebDriver or PhpBrowser.
# If you need both WebDriver and PHPBrowser tests - create a separate suite.
actor: AcceptanceTester
modules:
enabled:
- \Helper\Acceptance
- WebDriver
- Db
- Asserts
depends:
- Db:
- WebDriver:
- Asserts:
url: 'http://localhost/'
config:
WebDriver:
url: 'http://localhost/'
port: 4444
Db:
dsn: 'mysql:host=1.1.1.1;dbname=mysql;charset=utf8'
user: 'root'
password: 'password'
populate: false
cleanup: false
reconnect: true
env:
firefox:
modules:
config:
WebDriver:
url: 'http://localhost/'
window_size: 1920*1080
browser: firefox
capabilities:
acceptInsecureCerts: true
unexpectedAlertBehaviour: 'accept'
binary: "/opt/firefox/firefox-bin"
chrome:
modules:
config:
WebDriver:
url: 'http://localhost/'
window_size: 1920*1080
browser: chrome
capabilities:
chromeOptions: # additional chrome options
args: ["--no-sandbox", "--disable-notifications", "--start-maximized", "--disk-cache-dir=null", "--aggressive-cache-discard", "--disable-dev-shm-usage"]
After a lot of trial-and-errors, we eventually fixed our problem using the following code. The code uses JS functionalities to find the width and height of an element, then moves the cursor and selects the top right corner (This is where we found out that its not selecting the top left corner) :
$width = 'var a = document.evaluate(\''.$class.'\', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.offsetWidth; return a;';
$width = $I->executeJS($width);
var_dump($width);
$height = 'var a = document.evaluate(\''.$class.'\', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.offsetHeight; return a;';
$height = $I->executeJS($height);
var_dump($height);
$I->moveMouseOver($class,(($width/2)),0);
$I->wait(1);
$I->clickWithLeftButton($class,(($width/2)),0);
Let me know if more information is needed.
seeInSource
and seeInPageSource
have different descriptions and run different code paths, but ultimately do the very save comparison. Meaning there should be no seeInPageSource
method. Please remove.seeInSource
. It works fine in PhpBrowser. But it fails for WebDriver. I have found the solution: I could do str_replace(chr(13), '', $whatIWantToSeeMultiline)
and it will work for WebDriver. This is the old good \n vs \r\n. Could you please compare more intelligently, keeping in mind newline may differ?Webserver is Apache and it's run on same Windows machine, by the way.
unexpected alert open: {Alert text : Vyplňte pole Heslo}
(Session info: chrome=64.0.3282.186)
(Driver info: chromedriver=2.36.540471 (9c759b81a907e70363c6312294d30b6ccccc2752),platform=Linux 4.13.0-36-generic x86_64```
> Provide test source code if related
```php
<?php
$I = new SeleniumTester($scenario);
$I->wantTo('Nezadat heslo');
$I->amOnPage('/prihlaseni/');
$I->fillField('login', 'webmaster');
$I->click('_submit');
$I->wait(4);
$I->seeInPopup('Vyplňte pole Heslo');```
### Details
* Codeception version: 2.4.0
* PHP Version: 7.2
* Operating System: VirtualBox Ubuntu
* Installation type: Composer
```yml
actor: SeleniumTester
modules:
enabled:
- WebDriver:
url: http://webserver
browser: chrome
host: zalenium
port: 4444
- \Helper\Selenium
Some tips?
@Naktibalda If webdriver isn't getting a connection to the browser, is there a way to debug the interplay between the involved components: Codeception <-> Facebook WebDriver <-> chromedriver <-> chrome?
I.e. is there a way to "ping" Facebook WebDriver from Codeception? Then ping chromedriver, etc.?
fillField
on an input within a shadow root.
Using xpath to locate the input within a shadow root fails as xpaths do not work with Shadow DOM.
I believe Shadow DOM can only be accessed using JavaScript.
I tried getting the element using JavaScript then binding the element to a PHP variable but that does not seem to be supported.
$element = $I->executeJS('return document.evaluate(arguments[0], document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.shadowRoot.querySelector(arguments[1])', [ $prefix . "//app-datetime-picker", "input[name=shipped_date]" ]);
$I->fillFieldWhenAble($element, $value);
Results in error:
1) SomeTestSuiteCest: some Test
Test tests/acceptance/SomeTestSuite.php:someTest
[PHPUnit\Framework\Exception] Array to string conversion at ../repo/vendor/codeception/module-webdriver/src/Codeception/Module/WebDriver.php:2979
Scenario Steps:
97. $I->fillFieldWhenAble({"element-6066-11e4-a52e-4f735466cecf":"71aa7ad4-9fe3-4839-a473-1f7f60099d45"},"11/11/2017") at SomeFile.php:403
Unfortunately, I cannot find any documentation about Shadow DOM or Shadow Root anywhere on codeception.com or this repository.
Any help with a workaround would be appreciated.
A NoSuchElementException
error occurs:
[Facebook\WebDriver\Exception\NoSuchElementException] no such element: Unable to locate element: {"method":"xpath","selector":"//section[@id='fulfillments-sect-789-18013523-4074427']/div[@class='mini-form hybrid shipment-edit']/div[contains(@class,'panel-default')]/div[@class='panel-body']/form/div/div[contains(@class, 'ship-col')]//input[@name='shipped_date']"}
After switching my Ajax calls from jQuery to fetch
, this is not working anymore:
$I->waitForJS("return $.active == 0;", 5);
Judging from https://stackoverflow.com/questions/33625485/equivalent-of-jquery-active-for-pure-javascript there's probably no quick solution :-( Any ideas anybody?
in my env i have set window_size: 'maximize'
When i use frient function, this new browser window isnt maximize.
Using the scrollTo function I got some errors clicking elements since always aligns the element to the top. It has x and y offsets but running this on a different device is hard. So it will good to have an extra parameter to maybe have the option to align the element to top, bottom and center. I have checked the function scrollTo and I can add that functionally to it. It can be something similar to this: https://www.w3schools.com/jsref/met_element_scrollintoview.asp
The docs should give clear recommendations about which tools are best.
When asserting "small" pages, it sometimes can be handy to assert that the page source is equal to an expected string. REST module has a nice method for that: seeResponseEquals()
.
I'm suggesting to include the same functionality into WebDriver, calling it seeSourceEquals()
.
I suggested this for lib-innerbrowser
as well: Codeception/lib-innerbrowser#14
Write a custom action that uses the WebDriver locator service to locate an element by its selector string.
I would like to do this by getting the web driver module with $this->getModule('WebDriver')
rather than extending WebDriver
to keep my testing architecture consistent with other modules I've written.
Unable to use the functions because they're protected.
/**
* @param $selector
* @return WebDriverBy
* @throws \InvalidArgumentException
*/
protected function getLocator($selector)
{
if ($selector instanceof WebDriverBy) {
return $selector;
}
if (is_array($selector)) {
return $this->getStrictLocator($selector);
}
if (Locator::isID($selector)) {
return WebDriverBy::id(substr($selector, 1));
}
if (Locator::isCSS($selector)) {
return WebDriverBy::cssSelector($selector);
}
if (Locator::isXPath($selector)) {
return WebDriverBy::xpath($selector);
}
throw new \InvalidArgumentException("Only CSS or XPath allowed");
}
// ...and
/**
* @param array $by
* @return WebDriverBy
*/
protected function getStrictLocator(array $by)
{
$type = key($by);
$locator = $by[$type];
switch ($type) {
case 'id':
return WebDriverBy::id($locator);
case 'name':
return WebDriverBy::name($locator);
case 'css':
return WebDriverBy::cssSelector($locator);
case 'xpath':
return WebDriverBy::xpath($locator);
case 'link':
return WebDriverBy::linkText($locator);
case 'class':
return WebDriverBy::className($locator);
default:
throw new MalformedLocatorException(
"$by => $locator",
"Strict locator can be either xpath, css, id, link, class, name: "
);
}
}
It seems to me that these are services that the WebDriver
module should expose, as some public WebDriver
functions take WebDriverBy
arguments (e.g. WebDriver::findElements
). We need some service to get these WebDriverBy
arguments, or we won't be able to use the public function calls that are exposed through $this->getModule('WebDriver');
. Alternatively, maybe the WebDriver
module should expose some public findElement
type of function that takes a selector string rather than a WebDriverBy
instance.
Apologies if this has already been discussed, I didn't see it on the issues board. And thanks for making such a fantastic tool!
Just noticed that getCurrentURL()
(in RemoteWebDriver
) is not mentioned at https://codeception.com/docs/modules/WebDriver
RemoteWebDriver
at all? I mean: Why is it a separate file?I am using codeception behind a corporate proxy. My selenium grid is outside of the corporate network so I have to use the proxy server to connect to it.
In the suite config yml file you can specify http_proxy
and http_proxy_port
, but these are the settings that get injected into the browser itself to connect to the test object url. So we can't take use of them for this use case.
My suggested solution is to add two config keys to the suite config yml: webdriver_proxy
and webdriver_proxy_port
. These are passed to the facebook RemoteWebDriver which already supports this kind of proxy settings.
I am unable to use the scroll bar to scroll up and down, due to this i am unable to click on an element which can be seen only when i scroll down. Any way around this? or command that needs to be used.
Please help.
Run an Acceptance test on a set of tabs.
A variety of errors where $I can click on elements I can't see and can't see elements that I can click on.
Sometimes using performOn() solves the problem, sometimes it causes problems where see and click work.
I have four tabs (not browser tabs). They are overlaid except for the tab headings.
Each tab contains a button (in the same location) that reloads a grid.
In a loop, I select a tab by clicking on a heading then on the reload button, then perform a series of tests involving clicking and right-clicking on the grid.
All four tab heading are always visible, but after the first pass, Codeception considers them visible but can't see them. All selectors are unique in these examples.
$element = "#orphans-{$nameLower}s-reload";
$I->waitForElementVisible($element, 5);
// $I->see($element); // fails
$I->click($element);
The test above works as is, but fails when I uncomment the second line.
/* Test Rename grid item /*
$I->clickWithRightButton("//div[text() = '" . oPageVariables::$namePrefix . $name . "']");
$I->waitForElement("//span[text() = 'Rename {$name}(s)']");
$I->see("//span[text() = 'Rename {$name}(s)']");
$I->click("//span[text() = 'Rename {$name}(s)']"); // fails
This is the opposite problem. All tests succeed except the last one.
Replacing some of these with performOn(), solves the problem in some cases, but in other cases, replacing working code with performOn() fails.
My suspicion is that elements and their characteristics are cached on page load and not not updated when a new tab is selected. It also appears that tab headings of non-active tabs are considered invisible after the first tab is selected.
All operations work perfectly when done manually. I can make all tests pass with a lot of fiddling but no change in the source or logic (so all selectors are correct). I'm just pointing out that in an app that works fine, acceptance test operations that should work, don't when there are overlaid tabs.
I wish I could provide example code, but the code operates in the main page of a CMS, so it's massive (mostly generated by ExtJS 3) and deeply nested. I don't think it would help.
There's nothing useful in the command-line run output, even with -vvv. It just shows which tests pass and which fail.
Codeception version:
PHP Version: 2.5.2
Operating System: Windows 10
Installation type: Composer
List of installed packages (composer show
)
behat/gherkin v4.5.1 Gherkin DSL parser for PHP 5.3
codeception/codeception 2.5.2 BDD-style testing framework
codeception/phpunit-wrapper 7.6.1 PHPUnit classes used by Codeception
codeception/stub 2.0.4 Flexible Stub wrapper for PHPUnit's Mock Builder
doctrine/instantiator 1.1.0 A small, lightweight utility to instantiate object...
facebook/webdriver 1.6.0 A PHP client for Selenium WebDriver
guzzlehttp/guzzle 6.3.3 Guzzle is a PHP HTTP client library
guzzlehttp/promises v1.3.1 Guzzle promises library
guzzlehttp/psr7 1.5.2 PSR-7 message implementation that also provides co...
myclabs/deep-copy 1.8.1 Create deep copies (clones) of your objects
phar-io/manifest 1.0.3 Component for reading phar.io manifest information...
phar-io/version 2.0.1 Library for handling version information and const...
phpdocumentor/reflection-common 1.0.1 Common reflection classes used by phpdocumentor to...
phpdocumentor/reflection-docblock 4.3.0 With this component, a library can provide support...
phpdocumentor/type-resolver 0.4.0
phpspec/prophecy 1.8.0 Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage 6.1.4 Library that provides collection, processing, and ...
phpunit/php-file-iterator 2.0.2 FilterIterator implementation that filters files b...
phpunit/php-text-template 1.2.1 Simple template engine.
phpunit/php-timer 2.0.0 Utility class for timing
phpunit/php-token-stream 3.0.1 Wrapper around PHP's tokenizer extension.
phpunit/phpunit 7.5.1 The PHP Unit Testing framework.
psr/http-message 1.0.1 Common interface for HTTP messages
ralouphie/getallheaders 2.0.5 A polyfill for getallheaders.
sebastian/code-unit-reverse-lookup 1.0.1 Looks up which function or method a line of code b...
sebastian/comparator 3.0.2 Provides the functionality to compare PHP values f...
sebastian/diff 3.0.1 Diff implementation
sebastian/environment 4.0.1 Provides functionality to handle HHVM/PHP environm...
sebastian/exporter 3.1.0 Provides the functionality to export PHP variables...
sebastian/global-state 2.0.0 Snapshotting of global state
sebastian/object-enumerator 3.0.3 Traverses array structures and object graphs to en...
sebastian/object-reflector 1.1.1 Allows reflection of object attributes, including ...
sebastian/recursion-context 3.0.0 Provides functionality to recursively process PHP ...
sebastian/resource-operations 2.0.1 Provides a list of PHP built-in functions that ope...
sebastian/version 2.0.1 Library that helps with managing the version numbe...
symfony/browser-kit v4.2.2 Symfony BrowserKit Component
symfony/console v4.2.2 Symfony Console Component
symfony/contracts v1.0.2 A set of abstractions extracted out of the Symfony...
symfony/css-selector v4.2.2 Symfony CssSelector Component
symfony/dom-crawler v4.2.2 Symfony DomCrawler Component
symfony/event-dispatcher v4.2.2 Symfony EventDispatcher Component
symfony/finder v4.2.2 Symfony Finder Component
symfony/polyfill-ctype v1.10.0 Symfony polyfill for ctype functions
symfony/polyfill-mbstring v1.10.0 Symfony polyfill for the Mbstring extension
symfony/process v4.2.2 Symfony Process Component
symfony/yaml v4.2.2 Symfony Yaml Component
theseer/tokenizer 1.1.0 A small library for converting tokenized PHP sourc...
webmozart/assert 1.4.0 Assertions to validate method input/output with ni...
Suite configuration:
# Perform tests in browser using the WebDriver or PhpBrowser.
# If you need both WebDriver and PHPBrowser tests - create a separate suite.
actor: AcceptanceTester
modules:
enabled:
- \Helper\Acceptance
- WebDriver
- Asserts
config:
WebDriver:
url: 'http://localhost/test/'
browser: 'chrome'
window_size: 'maximize'
wait: 5
# window_size: false
#capabilities:
# chromeOptions:
#args: ["--headless", "--disable-gpu", "--disable-extensions"]
extensions:
enabled:
- Codeception\Extension\RunProcess:
- java -jar c:/Users/BobRay/Downloads/Selenium/selenium-server-standalone-3.9.0.jar
- C:/Users/BobRay/Downloads/selenium-drivers/chromedriver.exe
I try use in test:
$I->dontSeeInPopup('Some my text');
And in html report i have this:
no alert open
This is not good. Yes, popup window isnt show, but test must continous as if in popup is different text then: Some my text.
Tested in 2.3.7
I wanted to add some installation options from https://github.com/symfony/panther#installing-chromedriver-and-geckodriver, but #34 isn't online yet at https://codeception.com/docs/modules/WebDriver
I'm "suddenly" getting this in many tests in Firefox (haven't tried with Chrome yet):
[Facebook\WebDriver\Exception\ElementNotInteractableException] Element <...> could not be scrolled into view
Is anybody else observing this?
My current workaround: What used to be just $I->click(...);
is now:
$I->scrollTo('someNearbyElement');
$I->wait(0.5); // Some arbitrary number. I tried with `$I->waitForElementClickable()` but it isn't working :-(
$I->click(...);
geckodriver 0.30.0 with Firefox 99.0
Provide console output if related. Use
-vvv
mode for more details.
codecept run acceptance --steps
Provide test source code if related
Does not work in this setting in acceptance.suite.yml
class_name: AcceptanceTester
modules:
enabled:
- WebDriver:
url: 'http://myproject.dev'
browser: firefox
window_size: maximize
capabilities:
proxyType: 'manual'
noProxy: 'localhost, 127.0.0.1, *.dev'
httpProxy: '10.255.100.1:3128'
sslProxy: '10.255.100.1:3128'
- \Helper\Acceptance
#File vendor/codeception/codeception/src/Codeception/Module/WebDriver.php
Method _initialize() line 293-295
For my solution neccessary alter manual for settings use no proxy for in runtime browser.
Sets Selenium2 desired capabilities. Should be a key-value array proxy
https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities#proxy-json-object
My problem was to inform the browser the list of url no proxy in capabilities [noProxy]
if ($proxy = $this->getProxy()) {
$this->capabilities[WebDriverCapabilityType::PROXY] = $proxy;
}
#My solution
if ($proxy = $this->getProxy()) {
$this->capabilities[WebDriverCapabilityType::PROXY] = array(
'proxyType' => 'manual',
'noProxy' => 'localhost, 127.0.0.1, *.dev ',
'httpProxy' => '10.255.100.1:3128',
'sslProxy' => '10.255.100.1:3128'
);
}
composer show
)# paste suite config here
I have test when I will need to open browser with ssl certificate , the certificate is installed in my local chrome driver.
My situation is I need to pass local chrome configuration to chorme is open with seleniod
here is my yml file that I use to configure with seleniod:
modules:
enabled:
- Setter:
source: cash
- WebDriver:
browser: chrome
url: 'https://creditplus.ru/'
host: 192.168.4.117
window_size: 1376x768
restart: true
port: 4444
capabilities:
browserName: "chrome"
version: "65"
browserTimeout: 500
enableVNC: true
sessionTimeout: 120
name: "Cash here"
I tried to use the chrome profile like it shows below without any success:
modules:
enabled:
- Setter:
source: cash
- WebDriver:
browser: chrome
url: 'https://creditplus.ru/'
host: 192.168.4.117
window_size: 1376x768
restart: true
port: 4444
capabilities:
browserName: "chrome"
version: "65"
browserTimeout: 500
enableVNC: true
sessionTimeout: 120
name: "Cash here"
chromeOptions:
args: "user-data-dir=/home/strefi/.config/google-chrome/Default"]
When the browser open I am getting:
403 Forbidden
because there is no certificate
Please if someone have the situation with seleniod and Codeception help me.
In summary:
1- how I can export ssl certificate from local browser to seleniod in Codeception PHP
Set download options in firefox similar to what we can do with chrome. See yaml below.
Options are empty in firefox browser when I open url about:config.
composer show
)behat/gherkin v4.8.0 Gherkin DSL parser for PHP
codeception/codeception 4.1.17 BDD-style testing framework
codeception/codeception-progress-reporter 4.0.3
codeception/lib-asserts 1.13.2 Assertion methods used by Codeception core and Asserts module
codeception/module-asserts 1.3.1 Codeception module containing various assertions
codeception/module-db 1.1.0 DB module for Codeception
codeception/module-filesystem 1.0.3 Codeception module for testing local filesystem
codeception/module-webdriver 1.2.0 WebDriver module for Codeception
codeception/phpunit-wrapper 9.0.6 PHPUnit classes used by Codeception
codeception/stub 3.7.0 Flexible Stub wrapper for PHPUnit's Mock Builder
doctrine/instantiator 1.4.0 A small, lightweight utility to instantiate objects in PHP wi...
guzzlehttp/guzzle 7.2.0 Guzzle is a PHP HTTP client library
guzzlehttp/promises 1.4.0 Guzzle promises library
guzzlehttp/psr7 1.7.0 PSR-7 message implementation that also provides common utilit...
hoa/consistency 1.17.05.02 The Hoa\Consistency library.
hoa/console 3.17.05.02 The Hoa\Console library.
hoa/event 1.17.01.13 The Hoa\Event library.
hoa/exception 1.17.01.16 The Hoa\Exception library.
hoa/file 1.17.07.11 The Hoa\File library.
hoa/iterator 2.17.01.10 The Hoa\Iterator library.
hoa/protocol 1.17.01.14 The Hoa\Protocol library.
hoa/stream 1.17.02.21 The Hoa\Stream library.
hoa/ustring 4.17.01.16 The Hoa\Ustring library.
joomla-projects/joomla-browser v4.0.0.x-dev b5afd92 joomla-browser Codeception Module
myclabs/deep-copy 1.10.2 Create deep copies (clones) of your objects
nikic/php-parser v4.10.4 A PHP parser written in PHP
phar-io/manifest 2.0.1 Component for reading phar.io manifest information from a PHP...
phar-io/version 3.0.4 Library for handling version information and constraints
php-webdriver/webdriver 1.9.0 A PHP client for Selenium WebDriver. Previously facebook/webd...
phpdocumentor/reflection-common 2.2.0 Common reflection classes used by phpdocumentor to reflect th...
phpdocumentor/reflection-docblock 5.2.2 With this component, a library can provide support for annota...
phpdocumentor/type-resolver 1.4.0 A PSR-5 based resolver of Class names, Types and Structural E...
phpspec/prophecy 1.12.2 Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage 9.2.5 Library that provides collection, processing, and rendering f...
phpunit/php-file-iterator 3.0.5 FilterIterator implementation that filters files based on a l...
phpunit/php-invoker 3.1.1 Invoke callables with a timeout
phpunit/php-text-template 2.0.4 Simple template engine.
phpunit/php-timer 5.0.3 Utility class for timing
phpunit/phpunit 9.5.2 The PHP Unit Testing framework.
psr/container 1.0.0 Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher 1.0.0 Standard interfaces for event handling.
psr/http-client 1.0.1 Common interface for HTTP clients
psr/http-message 1.0.1 Common interface for HTTP messages
ralouphie/getallheaders 3.0.3 A polyfill for getallheaders.
sebastian/cli-parser 1.0.1 Library for parsing CLI options
sebastian/code-unit 1.0.8 Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup 2.0.3 Looks up which function or method a line of code belongs to
sebastian/comparator 4.0.6 Provides the functionality to compare PHP values for equality
sebastian/complexity 2.0.2 Library for calculating the complexity of PHP code units
sebastian/diff 4.0.4 Diff implementation
sebastian/environment 5.1.3 Provides functionality to handle HHVM/PHP environments
sebastian/exporter 4.0.3 Provides the functionality to export PHP variables for visual...
sebastian/global-state 5.0.2 Snapshotting of global state
sebastian/lines-of-code 1.0.3 Library for counting the lines of code in PHP source code
sebastian/object-enumerator 4.0.4 Traverses array structures and object graphs to enumerate all...
sebastian/object-reflector 2.0.4 Allows reflection of object attributes, including inherited a...
sebastian/recursion-context 4.0.4 Provides functionality to recursively process PHP variables
sebastian/resource-operations 3.0.3 Provides a list of PHP built-in functions that operate on res...
sebastian/type 2.3.1 Collection of value objects that represent the types of the P...
sebastian/version 3.0.2 Library that helps with managing the version number of Git-ho...
symfony/console v5.2.3 Eases the creation of beautiful and testable command line int...
symfony/css-selector v5.2.3 Converts CSS selectors to XPath expressions
symfony/deprecation-contracts v2.2.0 A generic function and convention to trigger deprecation notices
symfony/event-dispatcher v5.2.3 Provides tools that allow your application components to comm...
symfony/event-dispatcher-contracts v2.2.0 Generic abstractions related to dispatching event
symfony/finder v5.2.3 Finds files and directories via an intuitive fluent interface
symfony/polyfill-ctype v1.22.0 Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme v1.22.0 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-normalizer v1.22.0 Symfony polyfill for intl's Normalizer class and related func...
symfony/polyfill-mbstring v1.22.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php73 v1.22.0 Symfony polyfill backporting some PHP 7.3+ features to lower ...
symfony/polyfill-php80 v1.22.0 Symfony polyfill backporting some PHP 8.0+ features to lower ...
symfony/process v5.2.3 Executes commands in sub-processes
symfony/service-contracts v2.2.0 Generic abstractions related to writing services
symfony/string v5.2.3 Provides an object-oriented API to strings and deals with byt...
symfony/yaml v5.2.3 Loads and dumps YAML files
theseer/tokenizer 1.2.0 A small library for converting tokenized PHP source code into...
webmozart/assert 1.9.1 Assertions to validate method input/output with nice error me...
class_name: AcceptanceTester
modules:
config:
WebDriver:
host: 'selenium-test'
port: 4444
url: 'http://web-test'
browser: 'firefox'
restart: true
clear_cookies: true
window_size: 1024x1024
capabilities:
unexpectedAlertBehaviour: 'accept'
'goog:chromeOptions':
prefs:
download.default_directory: "/tmp/tests"
'moz:firefoxOptions':
prefs:
browser.download.folderList: 2
browser.download.defaultFolder: "/tmp/tests"
browser.download.dir: "/tmp/tests"
browser.download.downloadDir: "/tmp/tests"
browser.download.useDownloadDir: true
browser.helperApps.neverAsk.openFile: "application/csv"
username: 'admin'
password: 'admin'
database host: 'mysql-test'
database user: 'root'
database password: 'root'
database name: 'sites'
database type: 'mysqli'
database prefix: 'j_'
error_level: "E_ALL & ~E_STRICT & ~E_DEPRECATED"
Hi All,
I am trying to execute my codeception/webdriver tests on google chrome with a particular extension enabled.
So, I created a new chrome profile. The path is: ~/watchmaster/.config/google-chrome/Profile 2
Now I provided this path in my config yml file as:
modules:
config:
WebDriver:
host: localhost
port: 4444
browser: chrome
window_size: 1024x768
url: 'xxx'
capabilities:
unexpectedAlertBehaviour: 'accept'
chrome_profile: '/home/watchmaster/.config/google-chrome/Profile 2'
\Helper\EnvSpecificHelper:
languageCode: de_DE
environment: testing-de_DE
But when I execute my tests, it is not loading this profile.
I am using codeception v2.1.8
Any pointers how can I achieve loading this specific profile?
Thanks
Prateek
It would be nice to have a way to grab a cookie which is set by an ajax request (XHR, i.e. X-Requested-With: XMLHttpRequest
).
My use case:
set-cookie: PHPSESSID...
=> This is what I'd like to grab :-)With _saveScreenshot function, it will be good if it can get full screen result, similar like codeceptjs.
codeceptjs/CodeceptJS#522
Currently the saveScreenshot feature only capture 800x600 image when running it via headless chrome.
Example form:
<form>
<input type="text" name="username" />
<input type="submit" value="Submit" />
</form>
When running this in an acceptance test:
$I->submitForm('form',['username' => 'Test']);
This error occurs:
[TypeError] Argument 1 passed to Codeception\Module\WebDriver::getSubmissionFormFieldName() must be of the type string,
null given,
called in /var/www/html/vendor/codeception/module-webdriver/src/Codeception/Module/WebDriver.php on line 2434
The error is thrown because of the missing name
attribute from the submit input.
I've noticed the issue after updating from v1.4.0
to v2.0.0
(which introduced type safety). My test worked in v1.4.0
.
A shortcut match() selector for data attributes.
Need to specify the whole css selector
Using the example in https://medium.com/swlh/5-tricks-to-elevate-your-automated-regression-tests-762f437c55e6
<a href="/footwear/boots/ankle-boots" data-qaid="shop-ankle-boots">Shop ankle boots</a>
it could be along the lines of:
$i->click(['data' => 'qaid|shop-ankle-boots'])
while today it is:
$i->click(['css' => '[data-qaid="shop-ankle-boots"]']);
I just stumbled over https://github.com/dbrekelmans/browser-driver-installer. Does anybody have any experiences?
We could recommend it as simpler(?) way of installation at https://codeception.com/docs/03-AcceptanceTests#WebDriver and/or https://codeception.com/docs/modules/WebDriver
Next problem with Bootstrap custom radio button after #21
seeNumberOfElements()
doesn't count those radiobuttons:
<input type="radio" class="custom-control-input">
This is probably because of z-index:-1
in Bootstrap's CSS:
.custom-control-input{position:absolute;left:0;z-index:-1;width:1rem;height:1.22rem;opacity:0}
Background: When using Bootstrap's custom radiobuttons, the standard browser widget is replaced by some other widget (SVG?) for nicer graphics.
I'm filing this here mainly to see if somebody else encounters it. A possible solution could be to set a configuration parameter in acceptance.suite.yml
to switch the concerned methods' behavior to be compatible with Bootstrap.
In my case I can't look at the page's source code (what I'm guessing that e.g. seeNumberOfElementsInDOM()
is doing), since I'm showing/hiding some radiobuttons with JavaScript, and I need to assert their visibility. My workaround: Count the labels instead:
$I->seeNumberOfElements(['css' => 'div#foobar label'], 7);
I'm trying to use seeInPopup
after pressing a button that activates a popup. Unfortunately, the popup doesn't show up immediately, since it has to wait for the backend to respond, and depending on the machine running the tests it could take anywhere from half a second to a few seconds.
This means we end up just wait
ing a few seconds instead, which wastes time on a faster machine:
$I->click('Test connection');
$I->wait(5);
$I->seeInPopup('Connection successful.');
I'd rather avoid increasing the 'smart wait' value, if possible.
Ideally, the code would look like this:
$I->click('Test connection');
$I->waitForPopup('Connection successful.');
behat/gherkin v4.6.0 Gherkin DSL parser for PHP 5.3
behat/transliterator v1.2.0 String transliterator
browserstack/browserstack-local v1.1.0 PHP bindings for BrowserStack Local
codeception/codeception 3.0.0 BDD-style testing framework
codeception/phpunit-wrapper 6.0.16 PHPUnit classes used by Codeception
codeception/stub 2.1.0 Flexible Stub wrapper for PHPUnit's Mock Builder
composer/semver 1.5.0 Semver library that offers utilities, version constraint p...
composer/xdebug-handler 1.3.3 Restarts a process without xdebug.
consolidation/annotated-command 2.12.0 Initialize Symfony Console commands from annotated command...
consolidation/config 1.2.1 Provide configuration services for a commandline tool.
consolidation/log 1.1.1 Improved Psr-3 / Psr\Log logger based on Symfony Console c...
consolidation/output-formatters 3.4.1 Format text by applying transformations provided by plug-i...
consolidation/robo 1.4.9 Modern task runner
consolidation/self-update 1.1.5 Provides a self:update command for Symfony Console applica...
container-interop/container-interop 1.2.0 Promoting the interoperability of container objects (DIC, ...
defuse/php-encryption v2.2.1 Secure PHP Encryption Library
dflydev/dot-access-data v1.1.0 Given a deep data structure, access data by dot notation.
doctrine/annotations v1.4.0 Docblock Annotations Parser
doctrine/instantiator 1.0.5 A small, lightweight utility to instantiate objects in PHP...
doctrine/lexer 1.0.2 PHP Doctrine Lexer parser library that can be used in Top-...
elasticsearch/elasticsearch v5.4.0 PHP Client for Elasticsearch
ezyang/htmlpurifier v4.10.0 Standards compliant HTML filter written in PHP
facebook/webdriver 1.6.0 A PHP client for Selenium WebDriver
filp/whoops 2.3.1 php error handling for cool kids
firebase/php-jwt v5.0.0 A simple library to encode and decode JSON Web Tokens (JWT...
flow/jsonpath 0.4.0 JSONPath implementation for parsing, searching and flatten...
friendsofphp/php-cs-fixer v2.15.1 A tool to automatically fix PHP code style
fzaninotto/faker v1.8.0 Faker is a PHP library that generates fake data for you.
google/apiclient v2.2.2 Client library for Google APIs
google/apiclient-services v0.97 Client library for Google APIs
google/auth v1.5.1 Google Auth Library for PHP
google/recaptcha 1.2.1 Client library for reCAPTCHA, a free service that protects...
grasmash/expander 1.0.0 Expands internal property references in PHP arrays file.
grasmash/yaml-expander 1.4.0 Expands internal property references in a yaml file.
guzzlehttp/guzzle 6.3.3 Guzzle is a PHP HTTP client library
guzzlehttp/promises v1.3.1 Guzzle promises library
guzzlehttp/psr7 1.5.2 PSR-7 message implementation that also provides common uti...
guzzlehttp/ringphp 1.1.1 Provides a simple API and specification that abstracts awa...
guzzlehttp/streams 3.0.0 Provides a simple abstraction over streams of data
hamcrest/hamcrest-php v2.0.0 This is the PHP port of Hamcrest Matchers
hoa/consistency 1.17.05.02 The Hoa\Consistency library.
hoa/console 3.17.05.02 The Hoa\Console library.
hoa/event 1.17.01.13 The Hoa\Event library.
hoa/exception 1.17.01.16 The Hoa\Exception library.
hoa/file 1.17.07.11 The Hoa\File library.
hoa/iterator 2.17.01.10 The Hoa\Iterator library.
hoa/protocol 1.17.01.14 The Hoa\Protocol library.
hoa/stream 1.17.02.21 The Hoa\Stream library.
hoa/ustring 4.17.01.16 The Hoa\Ustring library.
jeremykendall/php-domain-parser 4.0.3-alpha Public Suffix List based URL parsing implemented in PHP.
jeroendesloovere/vcard 1.5.0 This VCard PHP class can generate a vCard with some data. ...
justinrainbow/json-schema 5.2.8 A library to validate a json schema.
lcobucci/jwt 3.2.5 A simple library to work with JSON Web Token and JSON Web ...
leafo/scssphp v0.7.7 scssphp is a compiler for SCSS written in PHP.
league/container 2.4.1 A fast and intuitive dependency injection container.
league/event 2.2.0 Event package
league/oauth2-server 5.1.6 A lightweight and powerful OAuth 2.0 authorization and res...
league/uri 4.2.3 URI manipulation library
mikey179/vfsStream v1.6.6 Virtual file system to mock the real file system in unit t...
mockery/mockery 1.2.2 Mockery is a simple yet flexible PHP mock object framework
monolog/monolog 1.24.0 Sends your logs to files, sockets, inboxes, databases and ...
myclabs/deep-copy 1.7.0 Create deep copies (clones) of your objects
nesbot/carbon 1.37.1 A simple API extension for DateTime.
nikic/fast-route v1.3.0 Fast request router for PHP
onelogin/php-saml 3.1.1 OneLogin PHP SAML Toolkit
paragonie/random_compat v2.0.18 PHP 5.x polyfill for random_bytes() and random_int() from ...
php-cs-fixer/diff v1.3.0 sebastian/diff v2 backport support for PHP5.6
phpdocumentor/reflection-common 1.0.1 Common reflection classes used by phpdocumentor to reflect...
phpdocumentor/reflection-docblock 3.3.2 With this component, a library can provide support for ann...
phpdocumentor/type-resolver 0.4.0
phpmailer/phpmailer v6.0.7 PHPMailer is a full-featured email creation and transfer c...
phpseclib/phpseclib 2.0.15 PHP Secure Communications Library - Pure-PHP implementatio...
phpspec/prophecy 1.8.0 Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage 4.0.8 Library that provides collection, processing, and renderin...
phpunit/php-file-iterator 1.4.5 FilterIterator implementation that filters files based on ...
phpunit/php-text-template 1.2.1 Simple template engine.
phpunit/php-timer 1.0.9 Utility class for timing
phpunit/php-token-stream 1.4.12 Wrapper around PHP's tokenizer extension.
phpunit/phpunit 5.7.27 The PHP Unit Testing framework.
phpunit/phpunit-mock-objects 3.4.4 Mock Object library for PHPUnit
pimple/pimple v3.2.3 Pimple, a simple Dependency Injection Container
psr/cache 1.0.1 Common interface for caching libraries
psr/container 1.0.0 Common Container Interface (PHP FIG PSR-11)
psr/http-message 1.0.1 Common interface for HTTP messages
psr/log 1.1.0 Common interface for logging libraries
ralouphie/getallheaders 2.0.5 A polyfill for getallheaders.
react/promise v2.7.1 A lightweight implementation of CommonJS Promises/A for PHP
roave/security-advisories dev-master baeb6f5 Prevents installation of composer packages with known secu...
robrichards/xmlseclibs 3.0.3 A PHP library for XML Security
sebastian/code-unit-reverse-lookup 1.0.1 Looks up which function or method a line of code belongs to
sebastian/comparator 1.2.4 Provides the functionality to compare PHP values for equality
sebastian/diff 1.4.3 Diff implementation
sebastian/environment 2.0.0 Provides functionality to handle HHVM/PHP environments
sebastian/exporter 2.0.0 Provides the functionality to export PHP variables for vis...
sebastian/global-state 1.1.1 Snapshotting of global state
sebastian/object-enumerator 2.0.1 Traverses array structures and object graphs to enumerate ...
sebastian/recursion-context 2.0.0 Provides functionality to recursively process PHP variables
sebastian/resource-operations 1.0.0 Provides a list of PHP built-in functions that operate on ...
sebastian/version 2.0.1 Library that helps with managing the version number of Git...
slim/slim 3.12.1 Slim is a PHP micro framework that helps you quickly write...
soundasleep/html2text 0.5.0 A PHP script to convert HTML into a plain text format
symfony/browser-kit v3.4.27 Symfony BrowserKit Component
symfony/console v3.4.27 Symfony Console Component
symfony/css-selector v3.4.27 Symfony CssSelector Component
symfony/debug v3.4.27 Symfony Debug Component
symfony/dom-crawler v3.4.27 Symfony DomCrawler Component
symfony/event-dispatcher v3.4.27 Symfony EventDispatcher Component
symfony/filesystem v3.4.27 Symfony Filesystem Component
symfony/finder v3.4.27 Symfony Finder Component
symfony/options-resolver v3.4.27 Symfony OptionsResolver Component
symfony/polyfill-ctype v1.11.0 Symfony polyfill for ctype functions
symfony/polyfill-mbstring v1.11.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php70 v1.11.0 Symfony polyfill backporting some PHP 7.0+ features to low...
symfony/polyfill-php72 v1.11.0 Symfony polyfill backporting some PHP 7.2+ features to low...
symfony/process v3.4.27 Symfony Process Component
symfony/stopwatch v3.4.28 Symfony Stopwatch Component
symfony/translation v3.4.27 Symfony Translation Component
symfony/validator v3.4.27 Symfony Validator Component
symfony/yaml v3.4.27 Symfony Yaml Component
tuupola/slim-jwt-auth 2.4.0 PSR-7 JWT Authentication Middleware
webmozart/assert 1.4.0 Assertions to validate method input/output with nice error...
wikimedia/composer-merge-plugin v1.4.1 Composer plugin to merge multiple composer.json files
modules:
enabled:
- \SuiteCRM\Test\Driver\WebDriver
config:
\SuiteCRM\Test\Driver\WebDriver:
url: "http://localhost/"
wait: 0
port: 9515 # ChromeDriver port
browser: chrome
window_size: false
clear_cookies: true
capabilities:
"goog:chromeOptions":
args: ["--headless", "--disable-gpu", "--no-sandbox", "window-size=1920x1080"]
binary: "/usr/bin/google-chrome-stable"
Maybe you should remove the changelog so that there are similar repositories everywhere?
example
When I use the dragAndDrop method of the WebDriver module the WebDriverButtonReleaseAction does not seem to run. The drag starts (WebDriverClickAndHoldAction), so the object I want to d&d is floating but the drop never happens, thus my test fails. Interestingly the dashed border appears around the drop zone, so the selenium can find it.
Environment:
Hello,
Just used the module Webdriver module today and found than the phpdoc for moveMouseOver has for typehint
WebDriver.php: line 2804:
* @param string $cssOrXPath css or xpath of the web element
But the example just above state than we can use it with the array selector ["css" => ".checkout"]
I've tried running it with the array selector and it's working.
But my usage of $I->moveMouseOver(["css" => ".checkout")
is marked as an phpstan error and could create other issue with other analysis tool.
When I try to run a test using lucatume/wp-browser
with a super basic test having only this: $I->loginAsAdmin();
.
[PHPUnit_Framework_Exception] Argument 1 passed to Codeception\Module\WebDriver::xpathLiteral() must be an instance of Codeception\Module\string, string given, called in ...\wp-content\plugins\
.vendor\codeception\module-webdriver\src\Codeception\Module\WebDriver.php on line 1100 and defined
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.