Unable to start selenium

47 views
Skip to first unread message

mahender Reddy M

unread,
Jul 20, 2011, 3:35:45 AM7/20/11
to Selenium Users
Hi

I'm using selenium with testng ..i followed configuration steps
follwed in testng site . im getting error while starting selenium .can
anybody help me , im new to this world.

Error is


RemoteTestNG starting
FAILED CONFIGURATION: @BeforeSuite
setupBeforeSuite(org.testng.TestRunner@a37368)
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:443)
at java.lang.Integer.parseInt(Integer.java:514)
at test.wordpress.setupBeforeSuite(wordpress.java:30)
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
org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:
81)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:
525)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:202)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:130)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:272)
at org.testng.SuiteRunner.run(SuiteRunner.java:235)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1049)
at org.testng.TestNG.runSuitesLocally(TestNG.java:974)
at org.testng.TestNG.run(TestNG.java:905)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:203)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:174)

Paul Hammant

unread,
Jul 20, 2011, 4:48:52 AM7/20/11
to seleniu...@googlegroups.com
This is a Java issue, not a Selenium issue.  Your clue is "java.lang.NumberFormatException ".  How much experience do you have with Java ? 


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.


mahender tester

unread,
Jul 20, 2011, 5:12:17 AM7/20/11
to seleniu...@googlegroups.com
I dont hav much exp in java .....just 3 months of exp ..

mahender tester

unread,
Jul 20, 2011, 5:13:38 AM7/20/11
to seleniu...@googlegroups.com
Can u tell me how to resolve this is issue .

Krishnan Mahadevan

unread,
Jul 20, 2011, 5:37:09 AM7/20/11
to seleniu...@googlegroups.com
You would need to share your Configuration method for someone to help you out.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

Ramesh A

unread,
Jul 20, 2011, 5:40:22 AM7/20/11
to seleniu...@googlegroups.com
Hi Mahendra,

Number format Expception is thrown to indicate that the application has attempted to convert a string to one of the numeric types, but that the string does not have the appropriate format. This is not related to selenium to be specific.

So, the work around is to avoid converting string to a number.  Hope this will solve your problem.  Check out ur code in the debug mode (If u r using any IDE) and fix the code appropriately


--
With Cheers & Regards
Ramesh

"Pleasure in the job puts perfection in the work."

mahender tester

unread,
Jul 20, 2011, 5:53:43 AM7/20/11
to seleniu...@googlegroups.com
Hi, Here is configuration code 



SeleniumServer server ;
HttpCommandProcessor proc;
DefaultSelenium selenium ;

@BeforeSuite(alwaysRun = true)
public void setupBeforeSuite(ITestContext context) {
  String seleniumHost = context.getCurrentXmlTest().getParameter("selenium.host");
  String seleniumPort = context.getCurrentXmlTest().getParameter("selenium.port");
  String seleniumBrowser = context.getCurrentXmlTest().getParameter("selenium.browser");
  String seleniumUrl = context.getCurrentXmlTest().getParameter("selenium.url");
  
  RemoteControlConfiguration rcc = new RemoteControlConfiguration();
 
  rcc.setPort(Integer.parseInt(seleniumPort));
  
  try {
    server = new SeleniumServer(false, rcc);
    server.boot();
  } catch (Exception e) {
    throw new IllegalStateException("Can't start selenium server", e);
  }
  
  proc = new HttpCommandProcessor(seleniumHost, Integer.parseInt(seleniumPort),
      seleniumBrowser, seleniumUrl);
  selenium = new DefaultSelenium(proc);
  selenium.start();
}

On Wed, Jul 20, 2011 at 3:10 PM, Ramesh A <rames...@gmail.com> wrote:
Hi Mahendra,

Number format Expception is thrown to indicate that the application has attempted to convert a string to one of the numeric types, but that the string does not have the appropriate format. This is not related to selenium to be specific.

So, the work around is to avoid converting string to a number.  Hope this will solve your problem.  Check out ur code in the debug mode (If u r using any IDE) and fix the code appropriately
H

mahender tester

unread,
Jul 20, 2011, 5:55:07 AM7/20/11
to seleniu...@googlegroups.com
In testng XML file im specifying like 


 <parameter name="selenium.host" value="localhost" />
  <parameter name="selenium.port" value="4444" />
  <parameter name="selenium.browser" value="*chrome /usr/lib/firefox-3.0.8/firefox" />
  <parameter name="selenium.url" value="www.google.com" />

Ramesh A

unread,
Jul 20, 2011, 6:07:24 AM7/20/11
to seleniu...@googlegroups.com
Hi Mahender,

I can see in ur code, u have defined the below mentioned declaration for the port as string
  String seleniumPort = context.getCurrentXmlTest().
getParameter("selenium.port");

and u r supplying the value as "4444" in the testng xml file.

In selenium, the port is a Numeric value and not a string.  So convert it to the Numeric constrain than a String value.

This should solve ur problem

--
With Cheers & Regards
Ramesh

"Pleasure in the job puts perfection in the work."



mahender tester

unread,
Jul 20, 2011, 6:22:12 AM7/20/11
to seleniu...@googlegroups.com
Hi , my main problem is not number format exception , but Values given in testng.XMl file are not inherting in my config file ...I'm trying to print those values in config file , it's giving null value . 

Krishnan Mahadevan

unread,
Jul 20, 2011, 6:23:42 AM7/20/11
to seleniu...@googlegroups.com
Thought so :)

I was about to ask you to see if the values are being extracted from your testng xml file by asking you to print them. You the man :) You got to that on your own :)


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



Ramesh A

unread,
Jul 20, 2011, 6:36:24 AM7/20/11
to seleniu...@googlegroups.com
Dude,

I have not worked on the testNG part.  But when u r declaring anything in the xml file u need to read it by parsing it.  so r u doing that??  If u r not parsing the property value in teh xml fine, then it will return the null value.  i dont know how these things are handled in the TestNG part. In case of J2EE, the application server will handle this which u define in the web.xml file. 

So if u r using testNG then check out how it reneders the data from the xml file,  or else u manually parse it using SAX parser.

Mean while, check out these links, these may sound to be usefull for u

http://code.google.com/p/testng/source/browse/trunk/src/org/testng/xml/Parser.java?spec=svn945&r=945

http://testng.org/doc/documentation-main.html#testng-xml

http://testng.org/doc/documentation-main.html



--
With Cheers & Regards
Ramesh

"Pleasure in the job puts perfection in the work."

Paul Hammant

unread,
Jul 20, 2011, 6:37:14 AM7/20/11
to seleniu...@googlegroups.com
You have a Java problem, not a Selenium one. You need a physically local experienced Java developer to help you.

- Paul
Reply all
Reply to author
Forward
0 new messages