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

  • SEARCH
  • Home
  • 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 8385771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:45:17+00:00 2026-06-09T17:45:17+00:00

Using the Selenium Server, is there a way to define a constant for the

  • 0

Using the Selenium Server, is there a way to define a constant for the app being tested through Selenium? To be more specific, I’m working with an app built on CakePHP. I would like to have Selenium define a PHP constant for the app to use before the app runs such that this constant will only be defined when the app is being run through Selenium. Is there a way something like this could be achieved? Thank you much!

  • 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-06-09T17:45:18+00:00Added an answer on June 9, 2026 at 5:45 pm

    I ended up just checking to see if the Selenium Server was running from within my program. To do this, I checked if the port the server runs on was open. I did this using the following code:

    if(!defined('SELENIUM_TEST')){
        $fp = @fsockopen('localhost', 4444);
        if ($fp !== false) {
            define('SELENIUM_TEST', true);
            fclose($fp);
        }
    }
    

    As long as this is done before you need to check the constant, then it should work fine.

    WARNING: If the Selenium Server is not running this will cause the app to stall while attempting to contact the socket.

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

Sidebar

Related Questions

I'm wondering if there's a (preferably built-in) way for Selenium hubs to ask for
I using PHPUnit and Selenium Server to testing Yii Application, but whenever i tried
I wanna run selenium tests from TeamCity using Maven at Linux server without display.
Is there any way to run a selenium python script that's supposed access a
I exported a working Selenium test case to Java, running it via selenium-rc's selenium-server.jar
Is there a way to test logging into a site with open id using
I want to run a selenium tests using python against a server farm that
I wanted to start Hub and node using selenium-server standalone jar. Command used are
I am using Selenium Server (v2.21) and Selenium Java Client (v.2.21.0) to automate a
Running a Selenium 2 RemoteWebDriver server using java -jar selenium-server-standalone-2.15.0.jar . I always get

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.