Skip to main content

First Test

package com.saucelabs.saucebindings.junit5.examples;

import com.saucelabs.saucebindings.SauceSession;
import com.saucelabs.saucebindings.junit5.SauceBindingsExtension;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openqa.selenium.WebDriver;

public class QuickStartExample {
WebDriver driver;
SauceSession session;

// Register SauceBindingsExtension
@RegisterExtension static SauceBindingsExtension sauceExtension = new SauceBindingsExtension();

// Store the session and driver objects
@BeforeEach
public void storeVariables() {
session = sauceExtension.getSession();
driver = sauceExtension.getDriver();
}


@Test
public void quickStartExample() {
// Use session to interact with Sauce Labs
session.annotate("Navigating to Swag Labs");
// Use the driver to interact with the web as normal
driver.get("https://www.saucedemo.com/");
}
}