I want to visit a website and input something
class example
{
public function setUp()
{
1 $host = 'http://localhost:4444/wd/hub';
2 $capabilities = DesiredCapabilities::firefox();
3 $driver = RemoteWebDriver::create($host, $capabilities, 5000);
4 $driver->get('http://www.baidu.com/');
5 $driver->findElement(WebDriverBy::id('kw'))->sendKeys('php');
}
}
When execute step 5 ,error has occur and I can't input 'php' automatically.
PHP Notice: Undefined index: ELEMENT in D:testvendorfacebookwebdriverlibRemoteRemoteWebDriver.php on line 178
PHP Stack trace:
PHP 1. {main}() D:debugexample.php:0
PHP 2. FacebookWebDriverexample->setUp() D:debugexample.php:20
PHP 3. FacebookWebDriverRemoteRemoteWebDriver->findElement() D:debugexample.php:16
Notice: Undefined index: ELEMENT in D:testvendorfacebookwebdriverlibRemoteRemoteWebDriver.php on line 178
Call Stack:
0.0002 356120 1. {main}() D:debugexample.php:0
0.0044 641504 2. FacebookWebDriverexample->setUp() D:debugexample.php:20
5.9112 976680 3. FacebookWebDriverRemoteRemoteWebDriver->findElement() D:debugexample.php:16
PHP Fatal error: Uncaught FacebookWebDriverExceptionUnknownCommandException: POST /session/9051ba4e-2f87-4f19-b07e-467d9484d01e/element//value
Build info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:54:15.039Z'
System info: host: 'DESKTOP-M7BARRS', ip: '192.168.1.50', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_131'
Driver info: driver.version: unknown in D:testvendorfacebookwebdriverlibExceptionWebDriverException.php:106
Stack trace:
Fatal error: Uncaught FacebookWebDriverExceptionUnknownCommandException: POST /session/9051ba4e-2f87-4f19-b07e-467d9484d01e/element//value
Build info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:54:15.039Z'
System info: host: 'DESKTOP-M7BARRS', ip: '192.168.1.50', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_131'
Driver info: driver.version: unknown in D:testvendorfacebookwebdriverlibExceptionWebDriverException.php on line 106
FacebookWebDriverExceptionUnknownCommandException: POST /session/9051ba4e-2f87-4f19-b07e-467d9484d01e/element//value
Build info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:54:15.039Z'
System info: host: 'DESKTOP-M7BARRS', ip: '192.168.1.50', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_131'
Driver info: driver.version: unknown in D:testvendorfacebookwebdriverlibExceptionWebDriverException.php on line 106
Call Stack:
0.0002 356120 1. {main}() D:debugexample.php:0
0.0044 641504 2. FacebookWebDriverexample->setUp() D:debugexample.php:20
5.9275 1105488 3. FacebookWebDriverRemoteRemoteWebElement->sendKeys() D:debugexample.php:16
5.9280 1117880 4. FacebookWebDriverRemoteRemoteExecuteMethod->execute() D:testvendorfacebookwebdriverlibRemoteRemoteWebElement.php:332
5.9280 1117880 5. FacebookWebDriverRemoteRemoteWebDriver->execute() D:testvendorfacebookwebdriverlibRemoteRemoteExecuteMethod.php:40
5.9280 1117976 6. FacebookWebDriverRemoteHttpCommandExecutor->execute() D:testvendorfacebookwebdriverlibRemoteRemoteWebDriver.php:535
5.9374 1157488 7. FacebookWebDriverExceptionWebDriverException::throwException() D:testvendorfacebookwebdriverlibRemoteHttpCommandExecutor.php:320
Hi, this is caused by #469 .
To solve the issue for now, you could either use Chrome (which works pretty well), or Selenium 3.4, or when using Selenium 3.5 and newer you must enable the protocol translating in Selenium (as mentioned in #469), using Selenium option -enablePassThrough false, like java -jar selenium-server-standalone-3.6.0.jar -enablePassThrough false.
Sorry for inconvenience :).
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)
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
The passthrough option was removed in new releases. How can we solve it now?
Most helpful comment
Hi, this is caused by #469 .
To solve the issue for now, you could either use Chrome (which works pretty well), or Selenium 3.4, or when using Selenium 3.5 and newer you must enable the protocol translating in Selenium (as mentioned in #469), using Selenium option
-enablePassThrough false, likejava -jar selenium-server-standalone-3.6.0.jar -enablePassThrough false.Sorry for inconvenience :).