public static void main(String[] args) throws IOException {     RbnRunner runner = new RbnRunner();     runner.run();  }  public void run() throws IOException {      System.setProperty("webdriver.chrome.driver", "/Users/me/samples/Adam_milford/src/chromedriver");      WebDriver driver = new ChromeDriver();   but when I want to init a headless selenium driver instead of Chrome driver, the code failes:  public static void main(String[] args) throws IOException {     WebDriver driver = new HtmlUnitDriver();   why is that?  Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/impl/conn/PoolingClientConnectionManager     at com.gargoylesoftware.htmlunit.HttpWebConnection.createHttpClient(HttpWebConnection.java:536)     at com.gargoylesoftware.htmlunit.HttpWebConnection.getHttpClient(HttpWebConnection.java:500)     at com.gargoylesoftware.htmlunit.HttpWebConnection.setUseInsecureSSL(HttpWebConnection.java:711)     at com.gargoylesoftware.htmlunit.WebClient.setUseInsecureSSL(WebClient.java:1096)     at org.openqa.selenium.htmlunit.HtmlUnitDriver.createWebClient(HtmlUnitDriver.java:263)     at org.openqa.selenium.htmlunit.HtmlUnitDriver.&lt;init&gt;(HtmlUnitDriver.java:129)     at org.openqa.selenium.htmlunit.HtmlUnitDriver.&lt;init&gt;(HtmlUnitDriver.java:172)     at org.openqa.selenium.htmlunit.HtmlUnitDriver.&lt;init&gt;(HtmlUnitDriver.java:168)     at RbnRunner.run(RbnRunner.java:40)     at RbnRunner.main(RbnRunner.java:28) Caused by: java.lang.ClassNotFoundException: org.apache.http.impl.conn.PoolingClientConnectionManager     at java.net.URLClassLoader.findClass(URLClassLoader.java:381)     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)     ... 10 more
785
I am getting a NoClassDefFoundError when I run my Java application.  What is typically the cause of this?
22253
Chrome refused to run a java app unless i upgraded to .45, which I did my dling the installer from oracle.  Java 7 u45.  Installer said it worked.  Chrome still won't start java.    $ which java /usr/bin/java  $ java -version java version "1.7.0_06" Java(TM) SE Runtime Environment (build 1.7.0_06-b24) Java HotSpot(TM) 64-Bit Server VM (build 23.2-b09, mixed mode) ~/private/WDI/git🍔     I may be easily fooled, but that doesn't say "45" anywhere.  (Yes, "06", and "24" and "23.2-b09", but nary a 45.  Such numbers!)  Anybody know if this is u45, or where the installer placed it?  UPDATE: there is a Java System Preference Panel that says "Your system has the recommended version of Java: Java 7 Update 45."  Still, Chrome doesn't appear to see it.
33203
What exception should I throw if I encounter an illegal state - for instance, an initialization method that should only be called once being called a second time?  I don't really see any built-in exception that makes sense.  This seems like something that should be in the framework - am I not poking in the right spot?
100093
I am using the following code in selenium, but I am not able to retrieve data from database. I am getting the errors "The result set has no current row"  My code is   public class Auto {      public static void main(String[] args) throws InterruptedException, SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException     {           Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");         System.out.println("Driver loaded");           Connection con=DriverManager.getConnection("jdbc:sqlserver://192.168.*****\\SQLEXPRESS/*****_DW/EPS:****;user=******;password=******; ");          System.out.println("Driver loadedd");       java.sql.Statement stmt= con.createStatement();     ResultSet rs=stmt.executeQuery("select * from [*****_DW].[dbo].dim_grantee ");      System.out.println("Query executed");      while (rs.next());     {         String Name=rs.getString("NAME");          System.out.println("Name is");     }   }
4404
Im getting above error when i was trying to run my test class. In my test class i will create an Account, Contact. And this contact id will be used in my original code to create Community user.  I noticed following help article from SFDC. But couldn't figure out how to achieve.   Here they asked to create User on the Test class and Runas this user. But in my case, the community user will be created in the code. Please share any thoughts.  Here is the detailed exception,     System.DmlException: Insert failed. First exception on row 0; first   error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, caused by:   System.DmlException: Insert failed. First exception on row 11; first   error: UNKNOWN_EXCEPTION, portal account owner must have a role: []
77755
&lt;servlet&gt;     &lt;servlet-name&gt;myservlet&lt;/servlet-name&gt;     &lt;servlet-class&gt;workflow.WDispatcher&lt;/servlet-class&gt;     &lt;load-on-startup&gt;2&lt;/load-on-startup&gt; &lt;/servlet&gt;  &lt;servlet-mapping&gt;     &lt;servlet-name&gt;myservlet&lt;/servlet-name&gt;     &lt;url-pattern&gt;*NEXTEVENT*&lt;/url-pattern&gt; &lt;/servlet-mapping&gt;   Above is the snippet from Tomcat's web.xml. The URL pattern *NEXTEVENT* on start up throws     java.lang.IllegalArgumentException: Invalid &lt;url-pattern> in servlet mapping   It will be greatly appreciated if someone can hint at the error. ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
92081
I am a beginner in Selenium WebDriver (Java with TestNg). I'm trying to create a framework of my own.  My question here is what would be the better option to store my objects (basically all the webelements of my website under test), Page Object Model or External Property file? Why? Is there a better method than those? Please help.
55180
So I have a method that takes as a parameter an Id of a object and uses it to make an external callout.  Unfortunately I can't seem to figure out any way to test it.  @isTest static void sometimes_salesforces_sucks() {    My_Object__c foo = new My_Object__c(Name='test');    insert foo;    MyClient client = new MyClient();    MyMockResponseGenerator mockResponse = new MyMockResponseGenerator();    Test.setMock(HttpCalloutMock.class,mockResponse);     Test.startTest();    client.bar(foo.Id);    Test.stopTest(); }    says that using start/stop test should work, but it doesn't work for me
14443
The Unhandled Exception's name is cut off in this  and in the answer too. The last 'n' looks like an 'r'.  Using Firefox 3.6.6.  Examples:
104361
I have a test class which calls a method from a helper class :  @isTest private class OpportunityCheckTest {      private CheckTestHelper helper = new CheckTestHelper();      @isTest     static void checkTest() {          helper.incrementCount();  &lt;-- ERROR INDICATES THIS LINE      } }   At the moment when I try to save my file, I'm getting the following error:  Result: [DEPLOYMENT FAILED]: OpportunityCheckTest.cls: Variable does not exist: helper     Can anyone explain what the problem is here?
103510
The code below is showing an error as if the file does not exist. I can find the chromedriver.exe file, but the .exe file seems to be non-executable.   These are my commands:  System.setProperty("webdriver.chrome.driver","driver = webdriver.Chrome(executable_path='/usr/local/share/chromedriver')");  WebDriver driver = new ChromeDriver(); driver.get("https://www.youtube.com/");   What may cause this dis-functionality?
90240
I have the below code:  public class CallOutForGet {      HttpRequest request=new Httprequest(); http http=new http(); request.setEndPoint('https://th-apex-http-callout.herokuapp.com/animals'); request.setmethod('GET');  HttpResponse response=http.send(request);  if(response.getStatusCode()==200){      Map&lt;String,Object&gt; results= (Map&lt;String,Object&gt;)JSON.deserializeUntyped(response.getBody());      List&lt;object&gt; animals=(List&lt;object&gt;)results.get('animals');     System.debug('Received Animals************');     for(object anim:animals){         System.debug(anim);     } }  }   This error at line -  request.setEndPoint('https://th-apex-http-callout.herokuapp.com/animals');  says expecting right parenthesis.
109534
I am trying to write a test class.  My Apex class has the following constructor:  public NController(ApexPages.StandardController controller) {      cas =  (Case) controller.getRecord();     csId = cas.Id;     owner = cas.OwnerId;      N_SSettings__c nhdsms = N_SSettings__c.getValues('Int');     rate=nhdsms.Rate_Code__c;     accId=nhdsms.Acc_Id__c;  }   Here N_SSettings__c is a custom settings which has two fields Rate_Code__c and Acc_Id__c. It has a record called 'Int' with both Rate_Code__c and Acc_Id__c field values populated.  I am using the following test class method:  @isTest public class NHSsendSMSController_Test {     public static testMethod void NHSsendSMSControllerTest()     {         Case caseObj = new Case();         insert caseObj;         ApexPages.StandardController sc = new ApexPages.standardController(caseObj);         NController nControllerObj = new NController(sc);         nControllerObj.methodName();     } }   When I run the test method, it is throwing a null pointer exception on the line :  rate = nhdsms.Rate_Code__c;   The custom setting is definitely present with the required values of both the fields of Int.
102132
Trying to run , embedded Tomcat instance fails.  Error seems to appear here:    Apr 17, 2015 2:13:47 AM org.apache.catalina.startup.HostConfig deployDescriptor  INFO: Deploying configuration descriptor /opt/OpenForisCalc/calc-server/tomcat/conf/Catalina/localhost/calc.xml  Apr 17, 2015 2:13:58 AM org.apache.catalina.core.StandardContext startInternal   SEVERE: Error listenerStart   Then if messes up with the rest (this repeats a lot):  Apr 17, 2015 2:13:58 AM org.apache.catalina.core.StandardContext startInternal  SEVERE: Context [/calc] startup failed due to previous errors
112781
This is the error I get when I run my web application in an instance of the Tomcat servlet container started by NetBeans. To fix this I even changed the heap size in netbeans.conf, but still it shows the same error. How can I keep this from happening?   HTTP Status 500 -   --------------------------------------------------------------------------------  type Exception report  message   description The server encountered an internal error () that prevented it from fulfilling this request.  exception   javax.servlet.ServletException: Servlet execution threw an exception     org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)   root cause   java.lang.OutOfMemoryError: Java heap space  note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
49620
I am beginner in automation field, I am trying to automated one of the module, I have tried many different XPATH to fetch proper XPATH for City field o UTest site. Im trying to automate registration module as one of my assignment. I have tried my different xpath example below:  //xpath="//body/div[@class='pac-container pac-logo']/div/span[2]/span" //div[@class='pac-item']/span[3] //div[@class='pac-item']/span //div[@class='pac-container pac-logo']/div/span[2]/../span[3]   the following code written:  //xpath to send data in field @FindBy(xpath="//input[@placeholder='Enter a location']") WebElement city;  //xpath for list to appear @FindBy(xpath="div[@class='pac-item']/span") List&lt;WebElement&gt; City;  public void EnterSignupTwo(String CiTy) throws Exception {     city.clear();     city.sendKeys(CiTy);     Thread.sleep(3000);     System.out.println("the size of List " +City.size());//printing list size      for(int i=0; i&lt;City.size(); i++ ) {         String cities = City.get(i).getText(); //storing list element in String         System.out.println("Converted value of city :"+cities); //print of total list      if(cities.contains(CiTy)) //if parameterized match with Available then click     {         System.out.println("enter specific value of city :"+City.get(i).getText());         City.get(i).click();         break;     } }   kindly refer the
114637
I did see the question about setting the proxy for the JVM but what I want to ask is how one can utilize the proxy that is already configured (on Windows).  Here is a demonstration of my issue:                Go to your Control Panel->Java and set a proxy address.      Run the following simple applet code (I'm using the Eclipse IDE):            import java.awt.Graphics; import javax.swing.JApplet; import java.util.*;  public class Stacklet extends JApplet {     private String message;     public void init(){         Properties props = System.getProperties();         message = props.getProperty("http.proxyHost", "NONE");               message = (message.length() == 0)? "NONE": message;     }      public void paint(Graphics g)     {         g.drawString(message, 20, 20);     } }   The Applet displays "NONE" without regard to the settings you've placed in the Java Control Panel. What would be best would be if the Windows proxy settings (usually set in Internet Explorer) were what I could determine but doing an extra configuration step in the Java Control Panel would still be an acceptable solution.  Thanks!