QualiT
QualiT

Reputation: 1955

Selenium click() not working for microsoftEdge webdriver

I've tried the standard

var elementForMs = driver.findElement(By.xpath(selector));
driver.executeScript("arguments[0].click()", elementForMs);

and

var elementForMs = driver.findElement(By.css(selector));
driver.executeScript("arguments[0].click()", elementForMs);

And there are simply cases where the element never responds to the click in Microsoft Edge 15.01563.

Upvotes: 0

Views: 1472

Answers (1)

Tarun Lalwani
Tarun Lalwani

Reputation: 146530

Each driver has unique bugs. So somethings that work in Firefox, may not work in Chrome or so on. So the only way around is to find what works and use it. And if possible report the issue to the driver owner

In your case since finding the element and clicking on it doesn't work with

var elementForMs = driver.findElement(By.xpath(selector));
driver.executeScript("arguments[0].click()", elementForMs);

But works when you use javascript directly in console. that means you should execute the same in your code

driver.executeScript("document.getElementXXX().click()");

Upvotes: 3

Related Questions