0

I am using selenium rc and exetuing

selenium.getText("//div/div[2][contains(@id,'gp-PACKAGE NAME-')]/div["+i+"]/table/tbody/tr/td["+1+"]/div")

I have to execute this command for 20-30 rows for which it takes 20-30 mins. I would like to get dom object for the table and parse it using java rather than executing selenium.getText for each row.

My expectation is that, I get dom object for all the rows from selenium and perform xpath query outside selenium using some dom parser.

Pero P.
  • 25,813
  • 9
  • 61
  • 85
sirfak
  • 11
  • 3
  • just performing a getText on a single page 20-30 times should never take 20-30 mins. Is there more to this problem than just this? – General Redneck Aug 18 '12 at 14:36

1 Answers1

0

Provided you already know what xpath parsing engine you want to use, you could always pass it the HTML of //div/div[2][contains(@id,'gp-PACKAGE NAME-')] and then do what ever you wanted to do to it.

To do that all you need is to grab the html using Javascript and getEval:

selenium.getEval("var document = selenium.browserbot.getcurrentwindow().document;" +
    "var xpathResults = document.evaluate('//div/div[2][contains(@id,\"gp-PACKAGE NAME-\")]', document, null, XPathResult.ANY_TYPE, null);" +
    "var element = xpathResults.iterateNext();" +
    "var innerHtml = element.innerHTML;"
);
General Redneck
  • 1,240
  • 2
  • 13
  • 28