I go strange problem with selenium when I am running them as group. Let me describe my problem in more details. When I am running just one test from ide everything is ok. But when I am trying to run them as a group always first test is passing, but after that tests are failing. In each of test I am finding and clicking same button. There is no problem with xPath because in chrome console element is found. After every test, I have method which is returning website to home location. Ach, and elements which I am testing are located in iFrame.
So let me copy paste some example code.
Api Class:
public class SiteImpl implemets BasicSite {
.
.
.
static {
swtichToTestedFrame();
}
private SiteImpl() {};
public static SiteImpl get() {
return new SiteImpl ();
}
@Override
public void clickCreateButton() {
Utils.findElementByXpathAndParam(XPath.DIV_TITLE_XPATH, BUTTON_TITLE).orElseThrow(
() -> new NoSuchElementException("Create button does not exist")).click();
}
private static void swtichToTestedFrame() {
WebElement iFrameElement = Utils.findElementByXpath(XPath.IFRAME_XPATH).orElseThrow(() -> new NoSuchElementException("iFrame does not exist"));
XdmWebDriver.getWebDriver().switchTo().frame(iFrameElement);
}
}
And lets say all tests looks like this, as I mentioned before only first test is passing. Event if all of them are the same.
@Test
public void test() {
ExportManagerImpl.get().clickCreateTask();
}
Obviously there is before and after method. Code is simplified obviously.
Aucun commentaire:
Enregistrer un commentaire