-
Notifications
You must be signed in to change notification settings - Fork 10
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.
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
}
});
....
}
}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.
A: See Sahagin configuration YAML#file-location
A: Change "reportOutputDir". See Sahagin configuration YAML#yaml-structure for detail.