0

I am trying to retrieve DOM element and pass it to third-party js script. I'm running javascript from java and first I use document.getElementById function to find it and then use it in another function. So, for instance, ID (which is dynamic) is isc_B6 and then function call looks like:

window.isc.AutoTest.getLocator(document.getElementById("isc_B6"))

and when I run it with Firebug it returns exactly what I want. But when I try to run it from Java:

public String getSCLocator(String id) {
    return selenium.getEval("window.isc.AutoTest.getLocator(document.getElementById(\"" + id + "\"))");
}

I get a value related to the DOM element that the mouse pointer is hovering over at the moment. I am sure that id is correct, because I can loop this function call and wait until value meets requirements - it happens when I hover over desired DOM element.

Danio
  • 1,064
  • 1
  • 11
  • 25
  • So what is `window.isc.AutoTest.getLocator` supposed to do? – Arran Jul 30 '14 at 11:18
  • Return string dependent on passed element, it's defined here: https://code.google.com/p/smartgwt/source/browse/trunk/main/src/com/smartclient/public/sc/system/tools/AutoTest.js?r=37 – Danio Jul 30 '14 at 11:19
  • After I investigated this issue I found out that document.getElementById always returns null – Danio Jul 30 '14 at 12:37

0 Answers0