php-webdriver / php-webdriver

PHP client for Selenium/WebDriver protocol. Previously facebook/php-webdriver
MIT License
5.11k stars 843 forks source link

Window not closed/quit #629

Closed vukitoso closed 4 years ago

vukitoso commented 5 years ago

What are you trying to achieve? (Expected behavior)

Open the page and close the browser window.
The page that I open for too long gives html (1-4 minutes), so it turns out timeout. The window does not close.

What do you get instead? (Actual behavior)

D:\opt\php\7.2\php.exe D:\home\NetBeansProjects\monitorLogin\1.php
1 WebDriverException! 
PHP Fatal error:  Uncaught Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http DELETE to /session/4cc4f5f747d67c11305ca42e953e78e3

Operation timed out after 30000 milliseconds with 0 bytes received in D:\home\NetBeansProjects\monitorLogin\Selenium\vendor\facebook\webdriver\lib\Remote\HttpCommandExecutor.php:292
Stack trace:
#0 D:\home\NetBeansProjects\monitorLogin\Selenium\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php(547): Facebook\WebDriver\Remote\HttpCommandExecutor->execute(Object(Facebook\WebDriver\Remote\WebDriverCommand))
#1 D:\home\NetBeansProjects\monitorLogin\Selenium\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php(289): Facebook\WebDriver\Remote\RemoteWebDriver->execute('quit')
#2 D:\home\NetBeansProjects\monitorLogin\1.php(23): Facebook\WebDriver\Remote\RemoteWebDriver->quit()
#3 {main}
  thrown in D:\home\NetBeansProjects\monitorLogin\Selenium\vendor\facebook\webdriver\lib\Remote\HttpCommandExecutor.php on line 292

Fatal error: Uncaught Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http DELETE to /session/4cc4f5f747d67c11305ca42e953e78e3

Operation timed out after 30000 milliseconds with 0 bytes received in D:\home\NetBeansProjects\monitorLogin\Selenium\vendor\facebook\webdriver\lib\Remote\HttpCommandExecutor.php:292
Stack trace:
#0 D:\home\NetBeansProjects\monitorLogin\Selenium\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php(547): Facebook\WebDriver\Remote\HttpCommandExecutor->execute(Object(Facebook\WebDriver\Remote\WebDriverCommand))
#1 D:\home\NetBeansProjects\monitorLogin\Selenium\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php(289): Facebook\WebDriver\Remote\RemoteWebDriver->execute('quit')
#2 D:\home\NetBeansProjects\monitorLogin\1.php(23): Facebook\WebDriver\Remote\RemoteWebDriver->quit()
#3 {main}
  thrown in D:\home\NetBeansProjects\monitorLogin\Selenium\vendor\facebook\webdriver\lib\Remote\HttpCommandExecutor.php on line 292

Process finished with exit code 255

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

<?php

namespace Facebook\WebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Exception\WebDriverException;

require_once('Selenium/vendor/autoload.php'); //Подключаем автолоадер классов

$host = 'http://localhost:4444/wd/hub'; // this is the default
$capabilities = DesiredCapabilities::chrome();
$driver = RemoteWebDriver::create($host, $capabilities, 5000, 30000);

try {
    $url_page = 'https://my.mos.ru/my/';
    $driver->navigate()->to($url_page);
    echo "Open OK \n";
} catch (WebDriverException $ex) {
    echo "1 WebDriverException! \n";
}

$driver->quit();

Details

vukitoso commented 5 years ago

copy https://github.com/SeleniumHQ/selenium/issues/6978

vitorleonel commented 5 years ago

@vebmaster i updated my google chrome to unstable version (75) and use chromedriver on version 74.

Doing this I was able to close the browser by executing 'quit';

vukitoso commented 5 years ago

@vitorleonel Not work. Window not closed.

OndraM commented 4 years ago

Thanks for the report, but it is not reproducible for me right now.

But fell free to open new issue if this prevails in latest versions of Chrome, Chromedriver, latest Selenium 3 , php-webdriver.

vukitoso commented 4 years ago

Thanks for the report, but it is not reproducible for me right now.

Test №2.

<?php

namespace Facebook\WebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Exception\WebDriverException;

require_once('vendor/autoload.php'); //Подключаем автолоадер классов

$host = 'http://localhost:9515'; // this is the default
$capabilities = DesiredCapabilities::chrome();
$driver = RemoteWebDriver::create($host, $capabilities, 5000, 10000);

try {
    $url_page = 'http://test1.ru/sleep.php';
    $driver->navigate()->to($url_page);
    echo "Open OK \n";
} catch (WebDriverException $ex) {
    echo "1 WebDriverException! \n";
} catch (WebDriverCurlException $ex) {
    echo "2 WebDriverCurlException! \n";
}

$driver->quit();

echo "End script";

Result:

D:\opt\OSPanel\modules\php\PHP_7.2\php.exe D:\home\NetBeansProjects\testSelenium\index.php
1 WebDriverException! 

Fatal error: Uncaught Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http DELETE to /session/6d2650a35b62f743c826dbe92c069486

Operation timed out after 10000 milliseconds with 0 bytes received in D:\home\NetBeansProjects\testSelenium\vendor\facebook\webdriver\lib\Remote\HttpCommandExecutor.php:297
Stack trace:
#0 D:\home\NetBeansProjects\testSelenium\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php(565): Facebook\WebDriver\Remote\HttpCommandExecutor->execute(Object(Facebook\WebDriver\Remote\WebDriverCommand))
#1 D:\home\NetBeansProjects\testSelenium\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php(307): Facebook\WebDriver\Remote\RemoteWebDriver->execute('quit')
#2 D:\home\NetBeansProjects\testSelenium\index.php(24): Facebook\WebDriver\Remote\RemoteWebDriver->quit()
#3 {main}
  thrown in D:\home\NetBeansProjects\testSelenium\vendor\facebook\webdriver\lib\Remote\HttpCommandExecutor.php on line 297
PHP Fatal error:  Uncaught Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http DELETE to /session/6d2650a35b62f743c826dbe92c069486

Operation timed out after 10000 milliseconds with 0 bytes received in D:\home\NetBeansProjects\testSelenium\vendor\facebook\webdriver\lib\Remote\HttpCommandExecutor.php:297
Stack trace:
#0 D:\home\NetBeansProjects\testSelenium\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php(565): Facebook\WebDriver\Remote\HttpCommandExecutor->execute(Object(Facebook\WebDriver\Remote\WebDriverCommand))
#1 D:\home\NetBeansProjects\testSelenium\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php(307): Facebook\WebDriver\Remote\RemoteWebDriver->execute('quit')
#2 D:\home\NetBeansProjects\testSelenium\index.php(24): Facebook\WebDriver\Remote\RemoteWebDriver->quit()
#3 {main}
  thrown in D:\home\NetBeansProjects\testSelenium\vendor\facebook\webdriver\lib\Remote\HttpCommandExecutor.php on line 297

Process finished with exit code 255

Window Chrome NOT CLOSE!

File "sleep.php":

page
<script src="sleep-src.php">

File "sleep-src.php":

<?php

echo "start-";
sleep(90);
echo "end";