Skip to main content

Posts

Script Error while running selenium scripts on IE

While running the selenium scripts on IE, we might get this error sometimes: Script Error on IE Solutions:  Possible that your pop-up blocker is enabled which is stopping selenium from opening another window (multi-window mode) - so add an exception to your pop-up blocker - Use this link to add/remove popup exceptions You can disable script errors on IE by disabling MDM.  Machine Debug Manager  Windows service (not only stop it, but prevent it from starting after the computer restarts). Follow this link to Disable Sometimes running the tests/starting the server as an ADMIN resolves the issue

Selenium: How to verify a hidden div tag exists

Most of the times we do have hidden div tags which need to be verified.  In most of the test designs, the first step towards testing a particular application is to verify that all the elements exist on the application under test.  Example:  Lets say we have a login page which has two text-fields. One for username the other for password. On the page, we also have a hidden div tag which is used by the developer to pass on the login failure message.  Usually its hidden but is set to visible when there is a login failure.  In usual test designs we would want to do something like this at the first step.  1. test all the components exist:  verifyTrue(selenium.isElementExists(LoginPage.username));  verifyTrue(selenium.isElementExists(LoginPage.password)); 2. Then give an incorrect username and password  selenium.type("LoginPage.username","SomeUserName"); selenium.type("LoginPage.password","SomePassword"); 3. Now verify that the...

Creating Unique Values using Date

Many a times we are in need of a unique value. The best way to generate a unique value is to use the current date and time combination. We can add both the current date and time to generate a unique value but there are times when we need more precise data to get uniqueness. For instance, you have two jobs running in the same minute then your unique value fails, i.e. when one job is ran at 9.32 AM after 10 milli secs and another is ran at 9.32 AM after 20 milli secs. At this time our unique generator creates the values as: 20111102932 (2011 - 11 - 02 9:32) for both the orders. This is when we will need to include millisecs too. To get the milli secs you can use the following commands in Java: long ldtInMillis = new Date().getTime(); System.out.println("Date - "+ ldtInMillis); Calendar lCalDtMillis = Calendar.getInstance(); System.out.println("Calender - " + lCalDtMillis.getTimeInMillis());

TestNG Error: Reference testng-impl-classpath not found

When we are running testng ant tasks we might get this error:  "Reference testng-impl-classpath not found" You should look at the testng.xml file you are using for testng to pick up your classes from!!! Like mine has the following:                          Now you should check if your classes mentioned in the file are found at the exact path.. I have a mistake in the path. My classes are found under Panels.LeftPanels.Barrel.TestBookBox Thus the error. So solution: Check if you have any mistake in the class path you mentioned!!!!

ssh connection refused on port 22

When we are trying to access another linux box using ssh we might get this error: ssh error: connection refused on 22 Hit this command: ps aux | grep ssh If you get two entries which list sshd and ssh-agent then it means ssh is running on your machine Kill those connections Start your ssh again This should resolve the issue!!!! If you have resolved it in any other way, please leave a comment. Thanks!

Working with User Defined Properties using ANT

Its quite useful to work with user defined properties using ANT. Lets say you have a build.xml in which you want to run a target based on a user input...In my case I want to decide on which URL to pass to Selenium based on the user selection of the stage to run the tests against... Add the following to the build.xml:  Now you can access the property from your program as  String urlString = System.getProperty("url"); If you are using TestNG framework, then you should add the property to your ant task in the build.xml file as:          To send this property from command line, you should send the property as  -Durl=