1

PhantomJS version : 2.1

Problem : My company just made a UI change in the app by using polymer and app url now contain /?dom=shadow. Due to this phantomJS is breaking during sendKeys to input element.

Html Element :

<input type="text" class="GO43PFXOS GO43PFXDK" id="tbUsername" placeholder="Username" maxlength="50" style="margin-top: 10px; width: 310px; height: 30px; text-align: left;">

Code example :

System.setProperty("phantomjs.binary.path", "lib//phantomjs");
    WebDriver d = new PhantomJSDriver();
    d.get(url);
    d.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    d.manage().window().maximize();
    d.findElement(By.id("tbUsername")).sendKeys(userName);

I am getting the below error on last line of above code :

org.openqa.selenium.UnsupportedCommandException: TypeError - undefined is not a constructor (evaluating '_getTagName(currWindow).toLowerCase()')

I am using binary PhantomJS and getting the above error for mac and linux system.

Also got multiple post on different forum that PhantomJS can't work with polymer Application. Example:

  1. How do you write end-to-end tests for Polymer (JS) based application (circa May 2015)?
  2. https://github.com/detro/ghostdriver/issues/445
  3. https://github.com/detro/ghostdriver/issues/450

Please suggest how can I solve the above problem.

Community
  • 1
  • 1
Rishi Roy
  • 31
  • 3
  • Should read the post: http://stackoverflow.com/q/37384458/4600982 – Supersharp Jan 27 '17 at 11:31
  • @Supersharp I tried `executeScript` method and it did not work. I am getting this error : `org.openqa.selenium.StaleElementReferenceException: {"errorMessage":"Element does not exist in cache"` – Rishi Roy Jan 29 '17 at 08:13

0 Answers0