0

I am running the following code (Java selenium client)- PAGE_NUMBER has a value, but I am unable to get it using selenium:

String script = "var cellValue = selenium.browserbot.getUserWindow().PAGE_NUMBER;";
selenium.runScript(script);

String value = selenium.getEval("selenium.browserbot.getUserWindow().cellValue;");
System.out.println("Value: " + value);

1 Answer 1

2

I don't know Selenium 1 at all and Selenium2/Webdriver is very different. However there are three things that I suspect to play a role in this issue:

  1. Scope: You declared the variable as local to the scope of the script (by writing var). You might try using a global variable by omitting the var keyword, so that you can access it later.
  2. Why do you try to access the variable via selenium.browserbot.getUserWindow().. Try omitting this part.
  3. The semicolon after cellValue is probably no good idea either

And then again, why not simply using

String value = selenium.getEval("selenium.browserbot.getUserWindow().PAGE_NUMBER");

?

I hope at least some part of this answer helps you. As I said I am just guessing.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.