Reputation: 11
We have automation project we need to click menu items we use this below code
((JavascriptExecutor) test.getDriver()).executeScript("mCLICK(arguments[0]);", substr);
its is working well in chrome browser we want migrate to edge . we are running the same code in micro soft Edge browser it's giving the below error
Exception class:org.openqa.selenium.JavascriptException the reason is:org.openqa.selenium.JavascriptException: javascript error: Function is not a constructor.
Pls advise
Upvotes: 0
Views: 167
Reputation: 11
I found the answer for click event for edge browser i put condition based on the browser
if(!browser.equals("edge")) { String substr = child.getAttribute("substr");
((JavascriptExecutor)
test.getDriver()).executeScript("mCLICK(arguments[0]);", substr); } else { test.getDriver().findElement(By.name(items[0])).click(); Thread.sleep(2000); test.getDriver().findElement(By.name(items[1])).click(); Thread.sleep(3000); test.getDriver().findElement(By.name(items[2])).click(); }
Upvotes: 0