Im using selenium webdriver(JAVA) on testing and I have a fire event method that should be reusable depending on the locator that is passed into it. My code is below :
public void fireEvent() {
((JavascriptExecutor) driver).executeScript("return document.getElementById('pin').blur()");
}
Is there a way for this specific code to accept any element ID on the 'pin', that can make it look like :
public void fireEvent(String locator) {
((JavascriptExecutor) driver).executeScript("return document.getElementById('{locator}').blur()");
}
Thanks in advance!