Menu

Selenium tests using STAF Process service

2009-05-06
2013-06-12
  • Arivuchelvan pandian

    Hi,

    I am trying to execute selenium tests using STAF Process service on a remote linux machine.

    staf 172.16.31.177 process start shell command 'java -jar selenium-server.jar -htmlSuite "*chrome" "http://localhost/myteam-beta" "./Blog_Suite.html" "results.html"' workdir '/opt/selenium/' wait stderrtostdout returnstdout

    When i run this command i am getting an error message,

    04:27:21.139 INFO - Preparing Firefox profile...

    (firefox-bin:15308): Gtk-WARNING **: cannot open display: 
    HTML suite exception seen:
    java.lang.RuntimeException: Timed out waiting for profile to be created!

    It is not able to bring up the firefox ui and hence i am getting this error. How do i bring up my ui when running tests using process service in staf. is there a way to enable interactive mode while running this tests.

    even if it is not selenium, if someone wants to execute tests which brings up GUI, then how can this be achieved.

    I have been searching this for a quite long time. any help on this will be highly appreciated.

    Thanks in advance.

     
    • David Michael Bender

      You may need to export the DISPLAY, or start STAFProc when logged into directly to the Linux system (i.e. not when remotely accessing the system via ssh or telnet).  The following thread discusses the same issue:

      http://sourceforge.net/forum/forum.php?thread_id=3261023&forum_id=104046
      "Not able to open firefox in SLED10 from STAF"

       
      • Arivuchelvan pandian

        Hi David,

        Thank you very much. I tried setting the DISPLAY variable

        staf 172.16.31.177 process start shell command 'java -jar selenium-server.jar -htmlSuite "*chrome" "http://localhost/myteam-beta" "./Blog_Suite.html" "results.html"' workdir '/opt/selenium/' wait stderrtostdout returnstdout ENV DISPLAY=172.16.31.177:0.0

        Response
        --------
        {
          Return Code: 1
          Key        : <None>
          Files      : [
            {
              Return Code: 0
              Data       : 11:10:04.809 INFO - Java: Sun Microsystems Inc. 11.2-b01
        11:10:04.810 INFO - OS: Linux 2.6.16.60-0.21-default i386
        11:10:04.811 INFO - v1.0-beta-2 [2571], with Core v1.0-beta-2 [2330]
        11:10:04.968 INFO - Version Jetty/5.1.x
        11:10:04.969 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
        11:10:04.970 INFO - Started HttpContext[/selenium-server,/selenium-server]
        11:10:04.970 INFO - Started HttpContext[/,/]
        11:10:04.982 INFO - Started SocketListener on 0.0.0.0:4444
        11:10:04.983 INFO - Started org.mortbay.jetty.Server@5ac072
        11:10:05.049 WARN - It looks like your baseUrl (http://localhost/iteam-beta) is pointing to a file, not a directory (it doesn't end with a /).  We're going to have to strip off the last part of the pathname.
        11:10:05.077 INFO - Preparing Firefox profile...

        (firefox-bin:30842): Gtk-WARNING **: cannot open display:
        HTML suite exception seen:
        java.lang.RuntimeException: Timed out waiting for profile to be created!

        And again got the same error. :(

        The other option which you have mentioned logging into the linux desktop, ya if start staf after logging to the linux machine and after that if i run the selenium tests, it is working fine. But the problem i have is this is an entire automation and i cannot manually login to the system for starting STAF. I really cannot use this option as i need to login manually but it works.

        Any other suggestion would be grateful.

         
        • Sharon Lucas

          Sharon Lucas - 2009-05-06

          Note that when a STAF PROCESS is started it runs in the same environment from which STAFProc was started plus whatever new environment variables are specified via the ENV options (if any) on a PROCESS START request.  So, to run Firefox (or any X application) via STAFProc, STAFProc needs to meet the requirements needed for an X application.

          Firefox is an X application.  So, for Firefox to run, it needs:
          1) The X server must be running (e.g. xstart) at the time that STAFProc is started
              (maybe you're starting STAFProc in the boot up sequence before xstart has been run?)
          2) Authorization to open X programs and a X display to connect to

          If you google, you'll see many hits on the "Gtk-WARNING **: cannot open display" error when trying to run Firefox (or other X applications), not related to STAF (e.g. when running via crontab, etc).  I don't really think this is really a STAF question, but rather it is a question about how to run an X application when you're not logged in.  Try googling to find out how you should do this.  Please post the solution you find.

           
          • Arivuchelvan pandian

            Thanks you very much sharon. I thought this could be handle in staf command like giving an option like interactive.

             
            • Sharon Lucas

              Sharon Lucas - 2009-05-08

              Note that another user was starting STAFProc via the boot.local file and then trying to use the STAF PROCESS START request to run firefox and this was failing because the X application was not started before STAFProc was started.  He resolved the problem by not starting STAFProc via the boot.local file.  Instead, he added the full path of STAFProc to the startup menu, so when the startup application starts, the X application server is already running before STAFProc is started.  So, now he can use a STAF PROCESS START request to launch firefox.

              For more info, see the forum posting at http://sourceforge.net/forum/message.php?msg_id=7380995.

               
  • Hugo811

    Hugo811 - 2012-05-11

    Hi,

    I know this is an old post but it is an actual issue for me yet.

    slucas said: "…Instead, he added the full path of STAFProc to the startup menu…"

    Now I am asking myself what the "startup menu" is?
    In STAF Installation Guide it is explained to start STAF in inittab, so i did in level 5.

    When I run my X-Application then there is nothing to be shown?

    When i execute a "set command" I am root but there is no Variable set for XWindows System. I tried it with adding the needed ENV Variables per STAX Env Tag  but the "startx()" script in the end of the "set" list will not be parsed as "KEY=VALUE" Variable for my environment.

    Pls see my previous post for more information. https://sourceforge.net/projects/staf/forums/forum/104046/topic/5259939

    Where can i determine when startx() is beeing initialized and set as variable?
    What is the default environment for inittab 5 ? Where can i see this?

    Thanks in advance.

     
  • Sharon Lucas

    Sharon Lucas - 2012-05-11

    I'm not sure what mrajkumar meant by the "startup menu" - as those are his words in the post that I was referring to at http://sourceforge.net/forum/message.php?msg_id=7380995.

    I do not understand what you mean by setting startx() as a variable.

    When/if startx() is being initialized is a system bootup question, not a STAF question.  You can try googling for more information on this.  Also, "What is the default environment for inittab 5" is not a STAF question.  Again, I suggest googling for more information.

     

Log in to post a comment.