Setting Sauce Options
Sauce Labs provides dozens of ways to configure your tests on our platform. Here is a full list with exhaustive descriptions
All of these configurations can now be easily set with the SauceOptions
class
import com.saucelabs.saucebindings.*;
import org.junit.Test;
import org.openqa.selenium.remote.RemoteWebDriver;
public class SauceSpecificOptions {
@Test
public void sauceOptions() {
// 1. Specify Sauce Specific Options
SauceOptions sauceOptions = new SauceOptions();
sauceOptions.setExtendedDebugging(true);
sauceOptions.setIdleTimeout(100);
sauceOptions.setTimeZone("Alaska");
// 2. Create Session object with the Options object instance
SauceSession session = new SauceSession(sauceOptions);
// 3. Start Session to get the Driver
RemoteWebDriver driver = session.start();
// 4. Use the driver in your tests just like normal
driver.get("https://www.saucedemo.com/");
// 5. Stop the Session with whether the test passed or failed
session.stop(true);
}
}
from saucebindings.options import SauceOptions
from saucebindings.session import SauceSession
class TestSauceOptions(object):
def test_creates_session(self):
# 1. Create a SauceOptions instance with Sauce Labs Specific Options
sauceOptions = SauceOptions(extendedDebugging=True,
idleTimeout=100,
timeZone='Alaska')
# 2. Create Session object with SauceOptions object instance
session = SauceSession(sauceOptions)
# 3. Start Session to get the Driver
driver = session.start()
# 4. Use the driver in your tests just like normal
driver.get('https://www.saucedemo.com/')
# 5. Stop the Session with whether the test passed or failed
session.stop(True)
require 'sauce_bindings'
require 'rspec'
describe 'Sauce Options' do
it 'creates session' do
# 1. Create a SauceOptions instance with Sauce Labs Specific Options
sauce_options = SauceBindings::Options.new(extended_debugging: true,
idle_timeout: 100,
time_zone: 'Alaska')
# 2. Create Session object with SauceOptions object instance
session = SauceBindings::Session.new(sauce_options)
# 3. Start Session to get the Driver
driver = session.start
# 4. Use the driver in your tests just like normal
driver.get('https://www.saucedemo.com/')
# 5. Stop the Session with whether the test passed or failed
session.stop(true)
end
end
C# bindings are coming soon...