ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronyk45 <wnaveenku...@gmail.com>
Subject Error in Junit whennI amn testing My Application in Selenium Server
Date Wed, 02 Dec 2009 04:36:04 GMT


com.thoughtworks.selenium.SeleniumException: ERROR: Element USERNAME not
found
	at
com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
	at
com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
	at com.thoughtworks.selenium.DefaultSelenium.type(DefaultSelenium.java:291)
	at com.example.tests.MySelenium.testMySelenium(MySelenium.java:31)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at junit.framework.TestCase.runTest(TestCase.java:164)
	at junit.framework.TestCase.runBare(TestCase.java:130)
	at
com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:212)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:120)
	at junit.framework.TestSuite.runTest(TestSuite.java:228)
	at junit.framework.TestSuite.run(TestSuite.java:223)
	at
org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
	at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
	at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Note the code written for this in Junit is 
---------------------------------------------------------------------------&&&&&-------------------------------------------
package com.example.tests;
import com.thoughtworks.selenium.*;
import junit.framework.*;
import java.util.regex.Pattern;

public class MySelenium extends SeleneseTestCase 
{
	private Selenium selenium; 
	public void setUp() throws Exception 
	{
		try
		{
			System.out.println("----------->1");
			selenium = new DefaultSelenium("localhost", 4444,
"*firefox","https://192.168.1.199:8443/");	
			selenium.start();
			System.out.println("----------->2");
		}
			catch(NullPointerException ne )
		{
			ne.printStackTrace();
		}
	}
	public void testMySelenium() throws Exception
	{
	 	try
	 	{
	 		System.out.println("------------->3");	 		
	 		selenium.open("/humanres/control/main");
	 		selenium.setTimeout("10000000000");
	 		selenium.waitForPageToLoad("10000000000");	 			
	 		selenium.type("USERNAME", "050008911");
	 		selenium.type("PASSWORD", "891136");	 			
	 		selenium.click("//input[@value='Login']");
	 		selenium.waitForPageToLoad("30000");
	 		selenium.click("link=Employee Transfer");
	 		selenium.waitForPageToLoad("30000");			
	 		selenium.click("link=Issue Transfer Order");	 		
	 		selenium.type("employeeId", "050008891");
	 		selenium.type("ordernumber", "10003");
	 		System.out.println("------------->4");
	 		selenium.type("currentofficeId", "10122");
	 		selenium.type("newofficeId", "10084");
	 		selenium.type("newdesignation", "EE");
	 		selenium.type("relievingDate", "2009-11-04");
	 		selenium.type("joiningDate", "2009-11-12");
	 		selenium.type("reason", "Delegates");
	 		selenium.click("link=Submit");
	 		assertEquals("Please enter date greater than or equal to current date",
selenium.getAlert());
	 		selenium.click("link=Submit");
	 		assertEquals("Please enter date greater than or equal to current date",
selenium.getAlert());
	 	
selenium.clickAt("//div[@id='content-main-section']/form/div/div[2]/table/tbody/tr[6]/td[6]/a/img",
"");
	 		selenium.click("//tr[3]/td[3]/div");
	 		selenium.click("link=Submit");
	 		assertEquals("Please enter date greater than or equal to current date",
selenium.getAlert());
	 		selenium.clickAt("//img[@alt='Calendar']", "");
	 		selenium.click("//tr[3]/td[4]/div");
	 		selenium.click("link=Submit");
	 		checkForVerificationErrors();
	 		System.out.println("------------>22a");	 		
	 	}
	 	catch(Exception e )
		{
	 		e.printStackTrace();
		}
	}	
	public static Test suite() 
	{
		System.out.println("----------->3");
		return new TestSuite(MySelenium.class);
    }
    public static void main(String args[]) 
    {
    	System.out.println("----------->4");
    	junit.textui.TestRunner.run(suite());
    }	
}

---------------------------------------------------------------------------&&&&&-------------------------------------------
Please help me as I am unable to solve this problem
Actually what happens is that when I run My Junit program then the
certificate explorer does not get opened as the certificate is getting
expired . Suggest me something whether there has to be done something with
the certificate to be downloaded in the codingpart . Please help me and if
possible send me a solution at the
wnaveenkumar@gmail.com,naveen.wuppuluri@sarathisolutions.com

 
-- 
View this message in context: http://old.nabble.com/Error-in-Junit-whennI-amn-testing-My-Application-in-Selenium-Server-tp26602171p26602171.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message