Reputation: 1730
I wrote a lot of tests in C#, but now at new job i have to write tests in Java. I had a class that's adding extension methods to webdriver (in C#):
public static class WebDriverExtensions
{
public static IWebElement FindDynamicElement(this IWebDriver driver, By by, int seconds = 10)
{
WebDriverWait waiter = new WebDriverWait(driver, TimeSpan.FromSeconds(seconds));
IWebElement dynamicElement = waiter.Until<IWebElement>((d) => d.FindElement(by));
return dynamicElement;
}
}
When Im using webdriver it was something like that:
Driver.FindDynamicElement(By.XPath("//div[text()='Discount applied']"));
Driver.FindElement(By.XPath("//div[text()='Discount applied']"));
How can i make something similar in JAVA?
Upvotes: 2
Views: 980
Reputation: 5197
Can't do much besides creating your own static methods (that will have to "wrap" instead of using the "after dot" extension method syntax), or create a wrapper class for the driver and add your methods there.
Upvotes: 2