I have a very basic question related to how to design method for executing selenium GRID.
In the current implementation of selenium framework in my project, we have created an action class which includes all selenium WebElelement actions in a static format. For sequential script execution, there is no issue. But for parallel script execution, I heard that we can't design a method as static as only one copy will be created. Then, how to write custom action method which we can use in other classes.
Could you please advise on this.
Current Implementation:
public class ActionUtil{
public static void selectByVisibleText(WebElement element, String visibleText, String elementName)
{
try {
Select oSelect = new Select(element);
oSelect.selectByVisibleText(text);
log.info(text + " text is selected on " + elementName);
} catch (Exception e) {
log.error("selectByVisibleText action failed.Exception occured :" + e.toString());
}
}
}
Use of 'selectByVisibleText' static method in other page classes:
public void selectMemorableQuestion1(String question) {
ActionUtil.selectByVisibleText(memorableQuestion1, question, "memorableQuestion1");
}