Skip to content
Nozomi Ito edited this page Apr 8, 2015 · 4 revisions

These are frequently asked questions.

Q: How should I call "WebDriverAdapter.setAdapter" method if multiple WebDriver instances are used in a test method?

A: Call setAdapter method with the WebDriver instance as the argument each time the current WebDriver instance is switched.

Q: Can I customize screen capture logic?

A: You can customize the logic as below:

import org.sahagin.runlib.external.adapter.webdriver.WebDriverAdapter;
import org.sahagin.runlib.external.adapter.AdapterContainer;
import org.sahagin.runlib.external.adapter.ScreenCaptureAdapter;

public class SampleTest {

    @Before
    public void setUp() {
        wd = new FirefoxDriver();
        // call setAdapter even when using custom screen capture logic
        WebDriverAdapter.setAdapter(wd);
        AdapterContainer.globalInstance().setScreenCaptureAdapter(new ScreenCaptureAdapter() {
            public byte[] captureScreen() {
                // return ((TakesScreenshot) wd).getScreenshotAs(OutputType.BYTES)
                // or any other custom screen capture logic
            }
        });
        .... 
    }
}

Q: I don't want to take screen capture by Sahagin

A: Set null to setScreenCaptureAdapter method as below:

import org.sahagin.runlib.external.adapter.webdriver.WebDriverAdapter;
import org.sahagin.runlib.external.adapter.AdapterContainer;
 
public class SampleTest {
 
    @Before
    public void setUp() {
        wd = new FirefoxDriver();
        WebDriverAdapter.setAdapter(wd);
        AdapterContainer.globalInstance().setScreenCaptureAdapter(null);
        .... 
    }
}

At this time, WebDriver instance passed to setAdapter method is used only for taking screen capture. But you should always call setAdapter method even if you don't need to take screen capture since this WebDriver instance may be used for other purpose in the future.

Q: I want to change sahagin.yml path or file name

A: See Sahagin configuration YAML#file-location

Q: I want to change Sahagin report output directory

A: Change "reportOutputDir". See Sahagin configuration YAML#yaml-structure for detail.

Clone this wiki locally