My Thoughts: Error Messages
Showing posts with label Error Messages. Show all posts
Showing posts with label Error Messages. Show all posts

Saturday, September 21

org.openqa.selenium.remote.SessionNotFoundException:Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones.

Sometimes when we are trying to load InternetExplorer from WebDriver we will get below error :


org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones. (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 1.39 seconds
Build info: version: '2.34.0', revision: '11cd0ef', time: '2013-08-06 17:11:28'
System info: os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version: '1.7.0_09'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver 


This error is because of the security settings in IE. There is a permanent fix to this. :P

>> Open IE , then go to Tools>>Security tab .

>>Now either check or uncheck the "Enable Protected Mode" checkbox for all zones i.e Internet , Local internet, Trusted Sites, Restricted Sites.


We are done . Now start running your script , it will go great  without any issues :) 

Tuesday, March 5

org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed.

If you running webdriver scripts on Windows 8 then the below error is the first one you will encounter. Atleast it happened for me :) .


org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: WIN8
Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:53:56'
System info: os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version: '1.7.0_09'
Driver info: driver.version: FirefoxDriver



The solution to the above problem is to specify the location of firefox in your script .
System.setProperty("webdriver.firefox.bin", "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");

Here is my modified script.And it went through without any errors :)

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class FacebookRegistration {

WebDriver driver;
 
 @BeforeTest
 public void start(){
  System.setProperty("webdriver.firefox.bin", "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
  driver = new FirefoxDriver();
 }
 

 @Test
 public void run(){
  driver.get("http://facebook.com");
 }
}

Tuesday, May 15

Permission denied for to get property Window.frameElement Command duration or timeout: 12 milliseconds

I used to get the below error when I try to switch to iframe ( driver.switchTo().frame("iframe_canvas") ).


Permission denied for <https://apps.facebook.com> to get property Window.frameElement Command duration or timeout: 12 milliseconds Build info: version: '2.21.0', revision: '16552', time: '2012-04-11 19:09:00' System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_23' Driver info: driver.version: RemoteWebDriver
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 
at java.lang.reflect.Constructor.newInstance(Unknown Source)


Seems this issue is happening because of Cross Origin .
Solution to this problem is set the below settings in Firefox Profile.
capability.policy.default.Window.QueryInterface='allAccess'

capability.policy.default.Window.frameElement.get='allAccess'

I changed my code as below. Now it is working fine :)
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
 
public void IframeTest(){

 WebDriver driver;

@BeforeTest
  public void setUpDriver() {
   FirefoxProfile profile = new FirefoxProfile();
   profile.setPreference("capability.policy.default.Window.QueryInterface", "allAccess");
   profile.setPreference("capability.policy.default.Window.frameElement.get","allAccess");
   driver = new FirefoxDriver(profile);
     }

@Test
 public void delete(){
   Common.FBLogin(fbUsername, fbPassword, driver);
   driver.get("appURL");
   driver.switchTo().defaultContent();
   driver.switchTo().frame("iframe_canvas");  
  }

}
For more details check this one  :
http://code.google.com/p/selenium/issues/detail?id=2863


If you ever happened to get the above error then change your Firefox preferences from code :)


Thursday, May 10

TestNG XMLfile preparation and error messages


Here is the sample TestNG file :

  
  
   
               
        
     
   
   
           
        
     
   


It is also important to know about error messages.Sometimes we learn more from errors :)
I have put some of the error messages we get when we go wrong in the above TestNG XML file .

Here are the error codes we will see when we have done any error in the above XML file.

1.If two tests are having the same name then we see below error
Ex :  
<test name="Testing the Google"> 
        <classes>       
        <class name="com.google.UI"/>
     </classes>
  </test> 
  <test name=" Testing the Google "> 
    <classes>       
        <class name="com.google.gmail"/>
     </classes>
  </test> 
Two tests in the same suite cannot have the same name: <<Test anme>>
at org.testng.TestNG.checkTestNames(TestNG.java:981)
at org.testng.TestNG.sanityCheck(TestNG.java:970)
at org.testng.TestNG.run(TestNG.java:1002)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:109)

2.If the testname doesnot elclosed in double quotes("") then we wills ee below error
Ex :  <test name=Testing the Google> 
The value of attribute "name" associated with an element type "null" must not contain the '<' character.
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:335)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:88)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
Caused by: org.xml.sax.SAXParseException: The value of attribute "name" associated with an element type "null" must not contain the '<' character.
atcom.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)

3.If the class name doesnt end with "/" character then we will see below error
org.testng.TestNGException: org.xml.sax.SAXParseException: The end-tag for element type "class" must end with a '>' delimiter.
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:335)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:88)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
Caused by: org.xml.sax.SAXParseException: The end-tag for element type "class" must end with a '>' delimiter.

4. If there is no space between parameter name and value  fields then we will see below error 
Ex   :  <parameter name="googleURL"value="http://google.com"/>
org.testng.TestNGException: org.xml.sax.SAXParseException: Element type "parameter" must be followed by either attribute specifications, ">" or "/>".
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:335)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:88)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
Caused by: org.xml.sax.SAXParseException: Element type "parameter" must be followed by either attribute specifications, ">" or "/>".

5.If the parameter attribute doesnt end with "/" character then we will see below error
Ex   :  <parameter name="googleURL"value="http://google.com">
org.testng.TestNGException: org.xml.sax.SAXParseException: Element type "class" must be followed by either attribute specifications, ">" or "/>".
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:335)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:88)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
Caused by: org.xml.sax.SAXParseException: Element type "class" must be followed by either attribute specifications, ">" or "/>".


6. If the two parameters have the same name and value attributes then we will see below error
Ex   :  <parameter name="googleURL"value="http://google.com"/>
          <parameter name="googleURL"value="http://google.com"/>
org.testng.TestNGException: org.xml.sax.SAXParseException: Element type "class" must be followed by either attribute specifications, ">" or "/>".
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:335)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:88)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
Caused by: org.xml.sax.SAXParseException: Element type "class" must be followed by either attribute specifications, ">" or "/>".

7.Make sure there are no spaces between "/" and  ">".If there are any spaces then we will see below error.
Ex   :  <parameter name="googleURL"value="http://google.com"/                >
org.testng.TestNGException: org.xml.sax.SAXParseException: Element type "class" must be followed by either attribute specifications, ">" or "/>".
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:335)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:88)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
Caused by: org.xml.sax.SAXParseException: Element type "class" must be followed by either attribute specifications, ">" or "/>".

Monday, May 7

Missing requirement: Jetty Server Adaptor Plug-in 1.0.4 (org.mortbay.jetty.serveradaptor 1.0.4) requires 'bundle org.eclipse.wst.server.core 0.0.0' but it could not be found


Today I tried to install Jetty plugin in Eclipse using the below URL
http://www.webtide.com/eclipse

But my installation failed with the below error

"Cannot complete the install because one or more required items could not be found.
Software currently installed: Jetty Generic Server Adaptor 1.0.
(org.mortbay.jetty.serveradaptor.feature.group 1.0.4)
Missing requirement: Jetty Server Adaptor Plug-in 1.0.4 
(org.mortbay.jetty.serveradaptor 1.0.4) requires 'bundle org.eclipse.wst.server.core 
0.0.0' but it could not be found
Cannot satisfy dependency:
From: Jetty Generic Server Adaptor 1.0.4 
(org.mortbay.jetty.serveradaptor.feature.group 1.0.4)
To: org.mortbay.jetty.serveradaptor [1.0.4] "

Solution to this problem is very simple .

Install Jetty plugin with the below URL
http://download.eclipse.org/jetty/updates/jetty-wtp

Steps :

  1. Open Eclipse.
  2. click Help -> Install New Software. The Available Software dialog box opens.
  3. Add the plugin using below URl  http://download.eclipse.org/jetty/updates/jetty-wtp


Detailed steps with instructions can be found at :
http://wiki.eclipse.org/Jetty_WTP_Plugin/Jetty_WTP_Install

Tuesday, May 1

TestNG : The reference to entity "tab" must end with the ';' delimiter.


Today I have faced problem while running the below TestNg XML file .

<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
<suite name="testing test suite">
  <parameter name="googlePlayUrl" value="https://play.google.com/store?hl=en&tab=w8"/>
  <test name="checking the Google play">
    <classes>
       <class name="com.google.play.UrlVerification"/>
    </classes>
  </test>
</suite>

When I run the above TestNG XML file I got bellow error

org.testng.TestNGException: org.xml.sax.SAXParseException: The reference to entity "tab" must end with the ';' delimiter.
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:335)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:88)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
Caused by: org.xml.sax.SAXParseException: The reference to entity "tab" must end with the ';' delimiter.

Solution to the above problem is very simple. Replace the "&" symbol with "&amp;"

I have changed my XML file like below and it was successed.

<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
<suite name="testing test suite">
  <parameter name="googlePlayUrl" value="https://play.google.com/store?hl=en&amp;tab=w8"/>
  <test name="checking the Google play">
    <classes>
       <class name="com.google.play.UrlVerification"/>
    </classes>
  </test>
</suite>

Thursday, April 26

FAILED CONFIGURATION: @BeforeTest setUpDriver java.lang.NoSuchMethodError: org.openqa.selenium.os.CommandLine.executeAsync()V



Today we have noticed the below errors while running our test scripts.


FAILED CONFIGURATION: @BeforeTest setUpDriver
java.lang.NoSuchMethodError: org.openqa.selenium.os.CommandLine.executeAsync()V
at org.openqa.selenium.firefox.FirefoxBinary.startFirefoxProcess(FirefoxBinary.java:92)
at org.openqa.selenium.firefox.FirefoxBinary.startProfile(FirefoxBinary.java:87)
at org.openqa.selenium.firefox.FirefoxBinary.clean(FirefoxBinary.java:225)
atorg.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:76)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:157)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:93)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:136)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:78)



So we have removed Android jars(android_webdriver_library-srcs.jar ,android_webdriver_library ) from our project Build path , then all the scripts started working fine.

We are still searching why this conflict happened and how to overcome this :)

Wednesday, April 4

Eclipse IAM Buckminster Integration 0.10.0.201003091836 (org.eclipse.iam.feature.buckminster.feature.group 0.10.0.201003091836)Missing requirement: Eclipse IAM Buckminster Integration 0.10.0.201003091836 (org.eclipse.iam.feature.buckminster.feature.group 0.10.0.201003091836) requires 'org.eclipse.buckminster.core [1.1.0,2.0.0)' but it could not be found

Today I tried Install Maven plugin from
http://q4e.googlecode.com/svn/trunk/updatesite-iam/

I got so many errors which reads

Eclipse IAM Buckminster Integration 0.10.0.201003091836 (org.eclipse.iam.feature.buckminster.feature.group 0.10.0.201003091836)Missing requirement: Eclipse IAM Buckminster Integration 0.10.0.201003091836 (org.eclipse.iam.feature.buckminster.feature.group 0.10.0.201003091836) requires 'org.eclipse.buckminster.core [1.1.0,2.0.0)' but it could not be found


If you ever get any error messages like above while installing Maven plugin OR using Maven plugin then try to reinstall Maven plugin again from the below URL.

http://download.eclipse.org/technology/m2e/releases

Goto
Eclipse >>Help>>Install New Software>>

and enter the URl to install Maven Plugin.