Reputation: 6084
I have an selenium integration test that launches browser and checks the webstore for any broken functionality. However the entire test runs too fast and finishes before I can even see which page is getting executed. How can I decrease the execution speed from my code. Currently I have following file that actually launches the test.
@Before
public void setUp() throws Exception {
urlProp = GenericUtils.loadProperties("url.properties");
this.BASE_URL = urlProp.getProperty("webstoreUrl");
xpathProp = GenericUtils.loadProperties("xpath.properties");
driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
@After
public void tearDown() {
driver.quit();
}
Upvotes: 0
Views: 4034
Reputation: 3817
You can play with EventFiringWebDriver
.
WebDriver driver = new FirefoxDriver();
EventFiringWebDriver slowDriver = new EventFiringWebDriver(driver);
slowDriver.registerListener(new ListenerThatAddsPauses(5, TimeUnit.SECONDS));
You will have to write your class ListenerThatAddsPauses
which will extend AbstractEventFiringListener
. In ListenerThatAddsPauses
you will have to override methods from parent class and for example add needed pauses. Something like:
@Override
public void beforeClickOn(WebElement element, WebDriver driver) {
Thread.sleep(timeout);
}
Here is a great example
Upvotes: 1