php 셀레니움을 설치 해보려 하는데 오류 아닌 오류가 발생 하여 고수님들의 도움을 얻고자 합니다!
설치는 https://github.com/php-webdriver/php-webdriver 여기를 참고 했고
이게 샘플로 주는 소스인데 이대로 적용을 하였습니다.
// This is where Selenium server 2/3 listens by default. For Selenium 4, Chromedriver or Geckodriver, use http://localhost:4444/
$host = 'http://localhost:4444/wd/hub';
$capabilities = DesiredCapabilities::chrome();
$driver = RemoteWebDriver::create($host, $capabilities);
// navigate to Selenium page on Wikipedia
$driver->get('https://en.wikipedia.org/wiki/Selenium_(software)');
// write 'PHP' in the search box
$driver->findElement(WebDriverBy::id('searchInput')) // find search input element
->sendKeys('PHP') // fill the search box
->submit(); // submit the whole form
// wait until 'PHP' is shown in the page heading element
$driver->wait()->until(
WebDriverExpectedCondition::elementTextContains(WebDriverBy::id('firstHeading'), 'PHP')
);
// print title of the current page to output
echo "The title is '" . $driver->getTitle() . "'\n";
// print URL of current page to output
echo "The current URL is '" . $driver->getCurrentURL() . "'\n";
// find element of 'History' item in menu
$historyButton = $driver->findElement(
WebDriverBy::cssSelector('#ca-history a')
);
// read text of the element and print it to output
echo "About to click to button with text: '" . $historyButton->getText() . "'\n";
// click the element to navigate to revision history page
$historyButton->click();
// wait until the target page is loaded
$driver->wait()->until(
WebDriverExpectedCondition::titleContains('Revision history')
);
// print the title of the current page
echo "The title is '" . $driver->getTitle() . "'\n";
// print the URI of the current page
echo "The current URI is '" . $driver->getCurrentURL() . "'\n";
// delete all cookies
$driver->manage()->deleteAllCookies();
// add new cookie
$cookie = new Cookie('cookie_set_by_selenium', 'cookie_value');
$driver->manage()->addCookie($cookie);
// dump current cookies to output
$cookies = $driver->manage()->getCookies();
print_r($cookies);
// close the browser
$driver->quit();
그런데 저 샘플을 적용시 이런 오류가 발생 하더라구요....;;;;
구글링을 해봐도 안나오고.... 내용을 봤을때에는 localhost 에 문제인거 같은데 이거 경험해 보신분 있나요??