Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined index: ELEMENT in RemoteWebDriver.php on line 178 #468

Closed
xiejie opened this issue Sep 1, 2017 · 11 comments
Closed

Undefined index: ELEMENT in RemoteWebDriver.php on line 178 #468

xiejie opened this issue Sep 1, 2017 · 11 comments

Comments

@xiejie
Copy link

xiejie commented Sep 1, 2017

What are you trying to achieve? (Expected behavior)

run example.php

What do you get instead? (Actual behavior)

Undefined index: ELEMENT

How could the issue be reproduced? (Steps to reproduce)

$host = 'http://localhost:4444/wd/hub'; 
$capabilities = DesiredCapabilities::firefox();
$driver = RemoteWebDriver::create($host, $capabilities, 5000);

$driver->get('http://www.seleniumhq.org/');
$link = $driver->findElement(
    WebDriverBy::id('menu_about')
);
$link->click();

Undefined index: ELEMENT in ...\Code\php-webdriver\lib\Remote\RemoteWebDriver.php on line 178

$raw_element

{
  'element-6066-11e4-a52e-4f735466cecf' =>
  string(36) "6ed86577-c854-4fb0-8e54-25ca485b820d"
}

Details

  • Php-webdriver version: 1.4.1
  • PHP version: 7.0
  • Selenium server version: 3.5.3
  • Operating system: Windows 10
  • Browser used + version: Firefox 54.0
  • Geckodriver: 0.18.0
@paulbriton
Copy link

paulbriton commented Sep 1, 2017

Try to run Selenium Server with -enablePassThrough false.
See https://github.com/SeleniumHQ/selenium/blob/master/java/CHANGELOG for more details

Also, you need to note that Geckodriver only implements the W3C spec, which isn't implemented yet in those bindings. So you might encounter some weird behaviour.

@OndraM
Copy link
Collaborator

OndraM commented Sep 1, 2017

Yes, @paulbriton is right, the default behavior of Selenium server changed with version 3.5. You can either:

  • Run selenium server with -enablePassThrough false to tell it to translate the protocols
  • Use selenium server 3.4.0 which translates the protocols by default.

I will update the README soon to mention this (i guess many people will now have this problem), and we will start working on long-term solution (support of the W3C WebDriver protocol).

@OndraM OndraM closed this as completed Sep 1, 2017
shimabox added a commit to shimabox/screru that referenced this issue Sep 9, 2017
@bperel
Copy link

bperel commented Sep 10, 2017

@OndraM Thanks for the suggestions. Any way to achieve this easily when using the Selenium Docker image?

@OndraM
Copy link
Collaborator

OndraM commented Sep 11, 2017

@bperel You can pass option to the Selenium server in Docker via SE_OPTS environment variable, see https://github.com/SeleniumHQ/docker-selenium#se_opts-selenium-configuration-options .

@Eddcapone
Copy link

Eddcapone commented Jul 13, 2018

How exactly does it work, I tried java -jar -Dwebdriver.gecko.driver="drivers/geckodriver.exe" selenium-server-standalone-3.9.1.jar -port 4444 -enablePassThrough false but then selenium is unable to start.

I get ' Error: Unable to access jarfile selenium-server-standalone-3.9.1.jar'

@cprn
Copy link

cprn commented Jul 14, 2018

Please, try to ask questions about running applications in forums or websites (e.g. stackoverflow). Github is for code, bug reports, contributing your code, ideas on how to change something in that code. Not for general help. Each comment sends an unnecessary email to everyone subscribed.

Above said:

How does it work? You run a java virtual environment and instruct it to set a variable webdriver.gecko.driver to value drivers/geckodriver.exe, then to load the file that contains selenium server and finally to pass it the rest of the line.

Where does it fail? Read the error you're getting. Java complains it can't access selenium-server-standalone-3.9.1.jar file so it's either an incorrect path or permissions on this file aren't set correctly.

@Eddcapone
Copy link

Eddcapone commented Jul 16, 2018

@cprn, Nope. Selenium server starts if I ommit -enablePassThrough false, so the path is correct. How does it work?

@hermann77
Copy link

java -jar selenium-server-standalone-3.14.0.jar -enablePassThrough false

causes
Exception in thread "main" com.beust.jcommander.ParameterException: Was passed main parameter '-enablePassThrough' but no main parameter was defined in your arg class
at com.beust.jcommander.JCommander.initMainParameterValue(JCommander.java:936)
at com.beust.jcommander.JCommander.parseValues(JCommander.java:752)
at com.beust.jcommander.JCommander.parse(JCommander.java:340)
at com.beust.jcommander.JCommander.parse(JCommander.java:319)
at org.openqa.grid.internal.cli.StandaloneCliOptions.parse(StandaloneCliOptions.java:28)
at org.openqa.grid.selenium.GridLauncherV3$1.(GridLauncherV3.java:256)
at org.openqa.grid.selenium.GridLauncherV3.lambda$buildLaunchers$0(GridLauncherV3.java:255)
at org.openqa.grid.selenium.GridLauncherV3.buildLauncher(GridLauncherV3.java:163)
at org.openqa.grid.selenium.GridLauncherV3.launch(GridLauncherV3.java:97)
at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:81)

@hermann77
Copy link

hermann77 commented Sep 12, 2018

In my case the only solution was:

Install chromedriver in a path that is in $PATH (/usr/bin or /bin)

and using in your test class:

$capabilities = DesiredCapabilities::chrome()

It works with executing Selenium standard way:

 java -jar selenium-server-standalone-3.14.0.jar

@dmitry-kulikov
Copy link

-enablePassThrough false does not work for me too. Selenium server 3.141.59 does not recognize this option. It seems that passthrough mode was removed in 3.9.0 and probably enablePassThrough disappeared with it (cannot disable non-existing mode) https://github.com/SeleniumHQ/selenium/blob/e280fb556d8d23d940eb6df8ef1f1fc6e96ba4cb/java/CHANGELOG#L152.
I was unable to use Gecko driver because of "Undefined index: ELEMENT" issue and switched to Chrome driver for now, it has not such problem.

@rsx491
Copy link

rsx491 commented May 23, 2019

-enablePassThrough false does not work for me too. Selenium server 3.141.59 does not recognize this option. It seems that passthrough mode was removed in 3.9.0 and probably enablePassThrough disappeared with it (cannot disable non-existing mode) https://github.com/SeleniumHQ/selenium/blob/e280fb556d8d23d940eb6df8ef1f1fc6e96ba4cb/java/CHANGELOG#L152.
I was unable to use Gecko driver because of "Undefined index: ELEMENT" issue and switched to Chrome driver for now, it has not such problem.

I'm encountering this same issue running on the following and using Facebook Webdriver; see below.

Chrome was working without issue but certain sites can detect JavsScript values and block automation.
So, I'm currently blocked because FireFox works but has data binding issues that are preventing my automation tests.

[capabilities:protected] => Facebook\WebDriver\Remote\DesiredCapabilities Object
(
[capabilities:Facebook\WebDriver\Remote\DesiredCapabilities:private] => Array
(
[acceptInsecureCerts] =>
[browserName] => firefox
[browserVersion] => 66.0.5
[moz:accessibilityChecks] =>
[moz:geckodriverVersion] => 0.24.0
[moz:headless] =>
[moz:processID] => 69687
[moz:profile] => /var/folders/r0/4ly92k1n10l3w77r8jgrjhfc0000gn/T/rust_mozprofile.MVkR8VjRnCwP
[moz:shutdownTimeout] => 60000
[moz:useNonSpecCompliantPointerOrigin] =>
[moz:webdriverClick] => 1
[pageLoadStrategy] => normal
[platformName] => mac
[platformVersion] => 18.2.0
[rotatable] =>
[setWindowRect] => 1
[strictFileInteractability] =>
[timeouts] => Array
(
[implicit] => 0
[pageLoad] => 300000
[script] => 30000
)

                                [unhandledPromptBehavior] => dismiss and notify
                                [webdriver.remote.sessionid] => 9a5a93fc-ec5f-374d-9d86-d14d327090c9
                            )

                    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants