Skip to main content

Posts

Showing posts with the label selenium server

Could not start Selenium session: You may not start more than one session at a time

Error is: java.lang.RuntimeException: Could not start Selenium session: You may not start more than one session at a time at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:107)   If you get this error on Selenium then this might be the problem… If in your test you are using a webdriver to create the DefaultSelenium or Selenium object then remove this line from your code:         selenium.start(); Happy Testing

Simulating Keyboard strokes using Selenium1

Many a times we want to simulate keyboard strokes in our selenium tests. Here is how you can do this using Selenium1.   Command: selenium.keyPressNative(<KeyEvent_TobePassed>);   For Ex: If you want to simulate pressing Tab then you need to pass the command: selenium.keyPressNative(java.awt.event.KeyEvent.VK_TAB+"");   View the list of KeyEvents here: http://docs.oracle.com/javase/1.4.2/docs/api/java/awt/event/KeyEvent.html   Hope this helps!

Shell Script to Check if Selenium Server is Running!

Many a times we would want to write up a script to start the selenium server using a shell script… So here is the script     #!/bin/sh # # @Author – Sirisha # @Date   - May 29 2012 # Script to start the Selenium Server on a given host #   # Defined the hostname hostname=somehostname # Defined the path to the selenium server serverPath=~/seleniumServer/ # Define the Selenium Server version jar server=selenium-server-standalone-2.12.0.jar # Define the Search String for the server SERVICE_STRING="'java -jar $server'"   # Clear the terminal clear   echo "service string is: $SERVICE_STRING" echo "Starting Selenium Server on $hostname"   # Run the command to get the process list ps -ef | grep -v grep | grep selenium   # Check if the Selenium Server is already running if [ $? -eq 0 ] then     echo "$server is running, everything is fine" else     echo "$server is not running"  ...