I was wondering if anyone could help me find a way to output to the Eclipse console the results returned from executing a Javascript ?
These are the steps I manually perform (that I would like to automate):
- Open test web page.
- Open Google chrome Javascript console
- Type "productObj.mainURL" and enter
This will output to the Chrome Javascript console the URL value/attribute that I'm looking for.
I've done a fair bit of research on my own, and I am stumped.
I've tried the code below:
JavascriptExecutor js = (JavascriptExecutor) driver;
String mainURL = (String) js.executeScript("productObj.mainURL");
System.out.println(mainURL);
But all I get returned is a "null"...
Any help please?