i am using Codeception for acceptance testing. On my local pc i have no problems to run the tests with selenium and chromedriver. Until 1 week, it works also fine at my git, but now, there comes this error.
"[PHPUnit\Framework\Exception] Undefined index: ELEMENT"
local it is working fine without errors.
I already searched this error and found an tip, that i have to start selenium with "-enablepassthrough false". But this does not really works.
Before 1 week with all the same setup, it works fine.
this is my acceptance.suite.yml:
actor: AcceptanceTester
modules:
enabled:
- WebDriver:
url: 'https://website.com'
host: 'selenium__standalone-chrome'
port: 4444
browser: chrome
window_size: 1920x1080
For Chrome/ChromeDriver v79 setting w3c to false in acceptance.suite.yml helped:
modules:
enabled:
- WebDriver:
capabilities:
chromeOptions:
w3c: false
This error message...
[PHPUnit\Framework\Exception] Undefined index: ELEMENT
...implies that the ChromeDriver's click() through Codeception is having an issue.
As per #reinholdfuereder's comment within the discussion facebook/php-webdriver - W3C WebDriver protocol support:
When using default W3C protocol, then the Codeception (v2.5.6) test fails with Undefined index: ELEMENT in waitForElement() operation.
When using legacy protocol, then the test succeeds for waitForElement() operation, which is followed by a seemingly also successful click() operation, but fails in the waitForElementNotVisible() operation.
Codeception's click() operation is translated into clickElement WebDriver command that is seemingly no more supported by ChromeDriver v75.
Solution
If you are using ChromeDriver v75.x and Chromium v75.x and you are seeing this error, you need to pass an additional chromeOptions w3c set to true.
Outro
You can find a couple of detailed discussion in:
How to turn off w3c in chromedriver to address the error unknown command: Cannot call non W3C standard command while in W3C
Cannot call non W3C standard command while in W3C mode (Selenium::WebDriver::Error::UnknownCommandError) with Selenium ChromeDriver in Cucumber Ruby
As #DebanjanB explained, setting the said option is a solution and this is what you get by updating facebook/php-webdriver to version >= 1.7.0
I think an even more solid solution (or habit) for your application is to use a specific docker image.
Your yaml makes me guess that you're using the selenium/standalone-chrome docker image. With their latest release (3.141.59-palladium) they updated the included Chrome version from 74 to 75 (see: https://github.com/SeleniumHQ/docker-selenium/releases).
Your local machine probably still runs an older version with Chrome 74 so no problems there. But whenever you rebuild the docker machine (e.g. when using some CI environment) you get the latest version. In this case a new Chrome version. Which "forces" you to also upgrade your php machine with a new facebook/php-webdriver.
I'd suggest to specify a version of the image to prevent these unwanted side effects, like
image: selenium/standalone-chrome:3.141.59-oxygen
or, if you've already made it run with Chrome 75, 3.141.59-palladium.
Related
Symfony 4 app running on Google App Eng (flex).
I deployed the app, but I am getting a 500 error, and app engine is providing no additional detail.
The deploy process I did was as follows:
(Following doc https://cloud.google.com/community/tutorials/run-symfony-on-appengine-flexible)
Include an app.yaml file as follows:
runtime: php
env: flex
runtime_config:
document_root: public
front_controller_file: index.php
env_variables:
APP_ENV: "prod"
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 0.5
disk_size_gb: 10
Update the composer line:
"post-install-cmd": [
"chmod -R ug+w $APP_DIR/var"
],
Cleared cache and warmed cache for production:
php bin/console cache:clear --env=prod --no-debug
php bin/console cache:warmup --env=prod --no-debug
Even though I haven't done the doctrine set up part, I should be able to go to xxxx.appspot.com and get the home page. Instead I get ...
xxxx.appspot.com is currently unable to handle this request. HTTP ERROR 500
This is puzzling because the app worked totally fine locally before warming the cache.
Am I deploying correctly or forgetting something? (I cant get any detail on error from App Engine).
Edit
I have checked the var/log local folder and found dev.log and prod.deprecations.log. In the latter I have this error many times ...
[2018-10-15 11:28:59] php.INFO: User Deprecated: Referencing controllers with a single colon is deprecated since Symfony 4.1, use "fos_user.security.controller::loginAction" instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Referencing controllers with a single colon is deprecated since Symfony 4.1, use \"fos_user.security.controller::loginAction\" instead. at C:\\dev\\projects\\jw-app\\vendor\\symfony\\framework-bundle\\Routing\\DelegatingLoader.php:98)"}
Based on the new edit information you’ve just provided it seems that the issue you are encountering is more on the Symfony version you are using than GAE.
Symfony 4.1 has deprecated the bundle notation. This means that it is no longer recommended to organize your business logic using bundles. You can see some examples of this on the official Symfony web page here.
Your error message tells you to use the following:
\"fos_user.security.controller::loginAction\
For the file at path:
C:\dev\projects\jw-app\vendor\symfony\framework-bundle\Routing\DelegatingLoader.php:98)
on line 98
It seems a few people have the following referencing issues with Symfony 4.1 as well. You can view the details of their similar issue and review recommended fixes at FriendsOfSymfony Github page.
Also, I would like to mention that since you are using GAE:Flex you can view your build history and error logs for your project at the following:
Google Cloud Build ( Google Cloud Console > Open the menu > tools > Cloud Build )
This will provide you the necessary information of the build you are trying to deploy on GAE.
I got a working setup of phpunit (5.7.23) and selenium standalone web driver (3.7.1) with ChromeDriver (2.29.461571) where I can run tests on.
Sadly I run into the issue that the moveTo-command does not take any effect. So that some Buttons could be found but they are not clickable by the error f.e.
"Element is not clickable at point (46, 633)"
With "does not take any effect" means that when I look at the screenshots I made, the viewport is the same as on start.
Example
($this inherits from PHPUnit_Extensions_Selenium2TestCase)
I am looking for the logout-Button which is an <a>-Tag. On the second line I want to move there.
$logout_link = $this->byId('nav-logout');
$this->moveto($logout_link);
I already tried the moveto-command with offset-settings -- also without any effect
I went down to selenium-standalone 3.6 and now it works ... maybe a bug in the new version.
The elasticSearch runs fine on my centos as a non-service. I run it as "sh bin/elasticsearch". The client I installed using composer is PHP v2.0. It just won't do anything it used to do before. I used this before and I could search, index documents, make index. Right now I cannot do anything because of this error. The strangest thing is that ElasticSearch seems to be running fine, and I can also call it with curl like:
curl localhost:9200
Please advise on the PHP API failure? I tried:
1. Opening port 9200 on my centos 6 for all
2. Used every method from the book in PHP API: search, index, delete index, etc...always get the same result and an exception is thrown in the Elasticsearch/Client class:
“No alive nodes found in your cluster”
3. Changed the owner of the directory nodes to centos, apache, elasticsearch - no use.
Resolved by installing a fresh latest tarball elasticsearch server and running it straight like this: sh bin/elasticsearch.
I am trying to get Selenium Web Driver to work with php using the Yii framework.
phpunit is installed and working.
I have the latest version of selenium server running. (selenium-server-standalone-2.37.0.jar)
I have this Yii extension for web driver installed.
I have this shell test.
Yii::import('ext.webdriver-bindings.CWebDriverDbTestCase');
class SiteTest extends CWebDriverDbTestCase
{
public function testExample() {
$this->get("http://www.example.com");
$this->assertTrue($this->isTextPresent('Example Domain'));
$this->assertTrue(true);
}
}
When I run it on the command line with
phpunit functional/SiteTest.php
The test runs. A firefox window opens with an empty profile (with the web driver plugin installed.) But the webpage doesn't load. There is nothing in the address bar. Nothing happens at all. The browser stays open, meanwhile the command line prints the following.
PHPUnit 3.7.28 by Sebastian Bergmann.
Configuration read from C:\full\path\to\yii\project\protected\tests\phpunit.xml
F
Time: 4.88 seconds, Memory: 3.50Mb
There was 1 failure:
1) SiteTest::testExample
Failed asserting that false is true.
C:\full\path\to\yii\project\protected\tests\functional\SiteTest.php:18
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
I'm on windows 7 and have tried turning off the firewall to see if that was the cause.
As you can see phpunit is working fine as the second test passes. But for some reason firefox is not opening the requested page.
Edit: I'm using the latest release of php (5.5.5)
Edit: I've now also tried with the Chrome Driver. I get the same result. Chrome opens but the page does not load. The address bar just has 'data:,' in it.
I have the same issue whenever I launch my scripts with the newest server nothing happens. But I noticed that if I use selenium server v2.33 everything works again (http://goo.gl/cxpyd2). However, I have been getting a execute js error that appears to happen with the new firefox and with 2.33? I am not sure. So I assume that it was fixed with the newer version of the server but I am not able to try it.
I experienced the same problem however downgrading the firefox version to 11.0 it started working. If you use linux you can use synaptic and force a firefox version downgrade
I just finished reinstalling the "All-In-One Eclipse PDT" from zend.com. It's unable to debug even the simplest "Hello World" PHP script. How can such a major open-source app be released in such a bad shape? What am I doing wrong?
This is the result of doing a "Debug As... 2. PHP Script":
Problem signature:
Problem Event Name: APPCRASH
Application Name: php.exe
Application Version: 5.2.9.9
Application Timestamp: 49dda267
Fault Module Name: ntdll.dll
Fault Module Version: 6.0.6002.18005
Fault Module Timestamp: 49e03824
Exception Code: c0000130
Exception Offset: 0006f04e
OS Version: 6.0.6002.2.2.0.768.3
Locale ID: 1033
Additional Information 1: 9d13
Additional Information 2: 1abee00edb3fc1158f9ad6f44f0f6be8
Additional Information 3: 9d13
Additional Information 4: 1abee00edb3fc1158f9ad6f44f0f6be8
Read our privacy statement:
http://go.microsoft.com/fwlink/?linkid=50163&clcid=0x0409
I think it wants me to configure some additional stuff, but I have no clue what exactly to do.
Did you check your PHP installation as in this thread?
After uninstalling XAMPP and reinstalling it (xampp-win32-1.7.0-installer.exe) and applying the xampp-patch2-win32-1.7.0-installer, I still have the problem of the PHP CLI closing and throwing the pop-up dialog.
OK, you must also copy "php_mysql_5.0.51a.dll" to "php_mysql.dll" and "php_mysqli_5.0.51a.dll" to "php_mysqli.dll" in "\xampp\php\ext".
Is your version of xdebug extension correct? Try the latest release
xdebug website