Download:
ChromeDriver - WebDriver for Chrome - Downloads
Current Releases If you are using Chrome version 115 or newer, please consult the Chrome for Testing availability dashboard. This page provides convenient JSON endpoints for specific ChromeDriver version downloading. For older versions of Chrome, please see below for the version of ChromeDriver
chromedriver.chromium.org
PHP:
<?php
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\WebDriverBy;
use Facebook\WebDriver\WebDriverExpectedCondition;
use Facebook\WebDriver\WebDriverWait;
require_once('vendor/autoload.php'); // Make sure to include your Selenium PHP bindings
$email = 'darshu@gmail.com'; // enter your email
$password = 'dash123'; // enter your password
$options = [
'args' => ['--headless', '--disable-gpu', '--window-size=1920x1080']
];
$driver = RemoteWebDriver::create('http://localhost:4444/wd/hub', \Facebook\WebDriver\Remote\DesiredCapabilities::chrome(), 5000, 10000, null, null, $options);
$wait = new WebDriverWait($driver, 20);
$url = 'https://accounts.google.com/AddSession?continue=https%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26app%3Ddesktop%26hl%3Den-GB%26next%3D%252F&hl=en-GB&passive=false&service=youtube&uilel=0';
$driver->get($url);
$wait->until(WebDriverExpectedCondition::visibilityOfElementLocated(WebDriverBy::name('identifier')))->sendKeys($email);
$wait->until(WebDriverExpectedCondition::visibilityOfElementLocated(WebDriverBy::name('Passwd')))->sendKeys($password);
sleep(3);
$url = 'https://youtu.be/9VpeTiz81gc'; // replace with your required URL to auto like the video
$driver->get($url);
$driver->findElement(WebDriverBy::cssSelector('#movie_player > div.ytp-chrome-bottom > div.ytp-chrome-controls > div.ytp-left-controls > button'))->click();
sleep(1);
$driver->findElement(WebDriverBy::xpath('/html/body/ytd-app/div[1]/ytd-page-manager/ytd-watch-flexy/div[5]/div[1]/div/div[2]/ytd-watch-metadata/div/div[2]/div[2]/div/div/ytd-menu-renderer/div[1]/ytd-segmented-like-dislike-button-renderer/div[1]/ytd-toggle-button-renderer/yt-button-shape/button/yt-touch-feedback-shape/div/div[2]'))->click();
sleep(4);
// The below code auto-subs after hitting the like
$driver->findElement(WebDriverBy::xpath('/html/body/ytd-app/div[1]/ytd-page-manager/ytd-watch-flexy/div[5]/div[1]/div/div[2]/ytd-watch-metadata/div/div[2]/div[1]/div/ytd-subscribe-button-renderer/yt-button-shape/button/yt-touch-feedback-shape/div/div[2]'))->click();
sleep(3);
// The below code opens the community tab of the channel and hits like for the first post
$driver->findElement(WebDriverBy::xpath('/html/body/ytd-app/div[1]/ytd-page-manager/ytd-watch-flexy/div[5]/div[1]/div/div[2]/ytd-watch-metadata/div/div[2]/div[2]/div/div/ytd-menu-renderer/div[1]/ytd-segmented-like-dislike-button-renderer/div[1]/ytd-toggle-button-renderer/yt-button-shape/button/yt-touch-feedback-shape/div/div[2]'))->click();
sleep(4);
$driver->quit();
?>