PHP Fatal error: Uncaught Error: Class 'Facebook\\WebDriver\\ChromeOptions' not found


namespace Facebook\WebDriver; use Facebook\WebDriver\Remote\DesiredCapabilities; use Facebook\WebDriver\Remote\RemoteWebDriver; require_once('vendor/autoload.php'); $host = 'http://localhost:4444/wd/hub'; $options = new ChromeOptions();

I have read this <a href="https://github.com/facebook/php-webdriver/wiki/ChromeOptions" rel="nofollow">link</a> when i creating object of class ChromeOptions getting error


PHP Fatal error: Uncaught Error: Class 'Facebook\WebDriver\ChromeOptions' not found.



Try this.

$options = new Chrome\ChromeOptions();


You are trying to instantiate ChromeOptions, but you aren't either 'using' the class (thus making its full path visible), not declaring its full namespace + classname when instantiating it.

So your code remains consistent, you could solve this by just adding the required use statement. E.g.:

use Facebook\WebDriver\Chrome\ChromeOptions;

Or, as Nanhe Kumar <a href="https://stackoverflow.com/a/47767561/1426539" rel="nofollow">said</a>, you could just use the fully qualified class name:

$options = new Chrome\ChromeOptions();

You could even do both, but that would be logically redundant. :)


  • Selenium: How do I start Chrome with RailsPanel Extension loaded?
  • How to inject Symfony param from parameters.yml into Behat 3 configuration?
  • Appium + Android + WebDriver findElement() : cannot find element after sendKeys()?
  • How to get github issues(tickets) from terminal?
  • Selenium Grid: set chrome *binary* path
  • Producing content indefinitely in a separate thread for all connections?
  • Trouble connecting to Docker registry stored on Nexus 3 Preview on Azure VM
  • Protractor - Cannot read property '$$testability' of undefined
  • Change language on Firefox with Selenium Python
  • How to get executing server name or address with Selenium Server 2.20
  • How to get a list of songs, artists, albums on WP7 devices?
  • Security Issue on Accessing Remote Image with dompdf
  • Bundle install fails - Gem using github url - What is wrong?
  • Doctrine: UniqueEntity with Many-to-Many field
  • Error processing multiple files
  • Eloquent paginate function in Slim 3 project using twig
  • Webgrid not refreshing after delete MVC
  • Jquery UI tool tip close icon
  • Initializer list vs. initialization method
  • Control modification in presentation layer
  • Sails.js/waterline: Executing waterline queries in toJSON function of a model?
  • Deleting and Updating values from a cusrsor adapter
  • Fetching methods from BroadcastReceiver to update UI
  • Modifying destination and filename of gulp-svg-sprite
  • 'TypeError' while using NSGA2 to solve Multi-objective prob. from pyopt-sparse in OpenMDAO
  • Upload files with Ajax and Jquery
  • Do I've to free mysql result after storing it?
  • Traverse Array and Display in markup
  • A cron job substitute?
  • InvalidAuthenticityToken between subdomains when logging in with Rails app
  • json Serialization in asp
  • SQL merge duplicate rows and join values that are different
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • Hits per day in Google Big Query
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Qt: Run a script BEFORE make
  • LevelDB C iterator
  • Linking SubReports Without LinkChild/LinkMaster
  • Can't mass-assign protected attributes when import data from csv file
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass