Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6165035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:05:45+00:00 2026-05-23T22:05:45+00:00

How can I store a value within Selenium-RC (through PHPUnit) and then retrieve/access it

  • 0

How can I store a value within Selenium-RC (through PHPUnit) and then retrieve/access it later using PHPUnit?

Suppose I run a command like the following in a test:

$this->storeExpression( "foo", "bar" );

If I understand the Selenium API documentation correctly, I could access this data using javascript{storedVars['foo']} using good ‘ol fashioned Selenese. It should contain the value "bar".

My question is this: how can I access this javascript{storedVars['test']} expression (or, more generally, javascript{storedVars} in PHPUnit?

For example, here’s a simple test I’ve run:

public function testStorage()
{
    $this->open('http://www.google.com/'); // for example
    $this->storeExpression( 'foo', 'bar' );
    $foo = $this->getExpression('foo');
    echo $foo;
}

The output of which is “foo” (among the other standard PHPUnit output), while I expect it should be “bar”. It’s just giving me back the name of the expression, not its value.

Can anyone with experience in this give me some guidance?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:05:46+00:00Added an answer on May 23, 2026 at 10:05 pm

    Good posts in this thread, but looks like no 100% working answer so far.

    Based on the Selenium reference here

    http://release.seleniumhq.org/selenium-core/1.0/reference.html#storedVars

    It would seem the correct code syntax would be:

    $this->storeExpression( 'bar', 'foo' );
    $foo = $this->getExpression("\${foo}");
    

    I haven’t tested that exactly, but doing something similar with

    $this->storeHtmlSource('srcTxt');
    $val = $this->getExpression('\${srcTxt}');
    print $val;
    

    did the trick for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What column type in Oracle 10g can be used to store any value of
I'd like to use a database to store i18n key/value pairs so we can
How can dynamic Key-value pairs of objects be stored in app.config in using the
How can I check check-boxes (on page load) according to value of check-boxes using
Problem I need a key-value store that can store values of the following form:
Say you have a bunch of files. Say you can store meta data to
As you know, in ASP.NET, you can store session data in one of following
Can I store a database connection in the Session object?
How can I store a hash table with separate chaining in a file on
Can I call HttpContext.Current from within a static class and Method? I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.