Method not yet implemented error while using javascriptExecutor while trying to access polymer DOM elements

Can you please assist in one more place where I have been struck for more than 1 week?

My application is written in Polymer JS and I am trying to access inner shadow elements using javascriptExecutor.

I wrote the code as below:

WebElement Root1 = driver.findElement(“Username”));
WebElement sRoot2 = expandRootElement(Root1);
String sRoot3 = sRoot2.findElement(By.cssSelector(“”)).getText();

using this method:

public WebElement expandRootElement(WebElement element) {

WebElement ele = (WebElement) ((JavascriptExecutor) driver).executeScript("return arguments[0].shadowRoot", element);
return ele;


I am getting error : org.openqa.selenium.WebDriverException: Method has not yet been implemented (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 28 milliseconds

I have also added the jars selenium-api-2.21.0 in addition to the existing jars. Kindly assist… I have googled many websides but couldnt find any solution.

Thanks & Regards