vendredi 2 octobre 2020

Test Automation - Wait Until ElementToBeClickable - where to store locators in framework

I work in test automation and I use WaitUntil_ElementIsVisible() in my test scripts and I store all these wait methods in a class called CustomWaitHelpers

CustomWaitHelpers.WaitUntil_ElementIsVisible(By.XPath("//div[contains(text(),'Files uploaded successfully')]"));

This is my method

 public static IWebElement WaitUntil_ElementIsVisible(By by, int timeoutInSeconds = 30)
        {
            var wait = new WebDriverWait(WebDriver.Driver, TimeSpan.FromSeconds(timeoutInSeconds));
            return wait.Until(ExpectedConditions.ElementIsVisible(by));
        }

However, unlike other waits such as WaitUntil_ElementToBeClickable() I can't pass an element as a parameter. In this case I store the elements in a page class using page object model framework.

So I am looking to find the best solution in where to store the values I pass in the parameter as in some cases I may use the same wait WaitUntil_ElementIsVisible() in the same test class

Where should I store (In this example "//div[contains(text(),'Files uploaded successfully')]")) in my framework?

Should I create a separate class/file and store these here? or what is the best/recommended approach in test automation standards?

I use POM, Visual Studio, Specflow, C# for my framework

Aucun commentaire:

Enregistrer un commentaire