Skip to end of metadata
Go to start of metadata

In this code example for PHP, the test runs a check to make sure that clicking a link brings you to the expected page. While simple, this example illustrates everything you need to run an automated test on Sauce Labs. First, it checks for your Sauce authentication credentials, which are set as environmental variables, and then sets the platform, browser, version, and other capabilities to use in the test. 

Finding Your Username and Access Key

You can find your Sauce Labs username and access key in the User Profile > User Settings section of your Sauce Labs dashboard.

You can also clone this script directly from our GitHub repo.

  // Setup: $ php composer.phar require facebook/webdriver

  use Facebook\WebDriver\Remote\RemoteWebDriver;
  use Facebook\WebDriver\WebDriverBy;

  $web_driver = RemoteWebDriver::create(
    array("platform"=>"Windows 7", "browserName"=>"chrome", "version"=>"40")

    Test actions here...