Getting XmlValueDisconnectedException while reading 4m excel | Selenium Forum
M
Posted on 29/01/2017
Hi Ashish,

I am getting below error on reading from excel. And this is specific to the this line, where I am trying to read the value from another sheet based on a condition. This is covered under Module 18, Part 8.

NOTE: I am closely following the steps you have mentioned. It will be great if you can help me to solve this problem.

if(data.startsWith("col")){

data = currentTestSuiteXLS.getCellData(currentTestCaseName, data.split("\\|")[1], currentTestDataSetID);

}

ERROR
org.apache.xmlbeans.impl.values.XmlValueDisconnectedException
at org.apache.xmlbeans.impl.values.XmlObjectBase.check_orphaned(XmlObjectBase.java:1213)
at org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTXfImpl.getXfId(Unknown Source)
at org.apache.poi.xssf.model.StylesTable.getStyleAt(StylesTable.java:183)
at org.apache.poi.xssf.usermodel.XSSFCell.getCellStyle(XSSFCell.java:427)
at org.apache.poi.xssf.usermodel.XSSFCell.getCellStyle(XSSFCell.java:63)
at org.apache.poi.ss.usermodel.DateUtil.isCellDateFormatted(DateUtil.java:280)
at strattonXlsRead.Xls_Reader.getCellData(Xls_Reader.java:101)
at strattonTest.DriverScript.executeKeywords(DriverScript.java:170)
at strattonTest.DriverScript.start(DriverScript.java:128)
at strattonTest.DriverScript.main(DriverScript.java:74)

M
Replied on 29/01/2017

download the latest version of poi api and try again

https://www.apache.org/dyn/closer.lua/poi/release/bin/poi-bin-3.15-20160924.zip


M
Replied on 30/01/2017

Thanks for the quick reply. Just to add we also need to add commons-collections4-x.x.jar but Apache has removed the Interface ListValuedMap from commons-Collections4-4.0.jar so use updated version 4.1 it has the required classes and Interfaces.

Refer here if you want to read Excel (2003 or 2007+) using java code.

http://www.codejava.net/coding/how-to-read-excel-files-in-java-using-apache-poi


M
Replied on 30/01/2017

I am getting below error whenever any of the test step fails and halts my flow of execution. I have all the keywords in try catch block. But not sure what is causing this.

Here is the snippet of a keyword.
@SuppressWarnings("deprecation")
public String VerifyText(String object,String data) {
String expected = data;
String actual = driver.findElement(By.xpath(OR.getProperty(object))).getText();
APP_LOGS.debug("verifyText" + "expected" + data);

try{

Assert.assertEquals(expected.trim(), actual.trim());

APP_LOGS.debug("verifyText");
}catch (Exception e) {
return Constants.KEYWORD_FAIL + object +" Not found." +"Error message: " + e.getMessage() ;
}

return Constants.KEYWORD_PASS;
}

Error that I am getting

Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)

NOTE: this is from Module 19. Also, the same code worked fine while I tested, without the actually implementing keyword. Something like

public String VerifyText(String object,String data) {
return Constants.KEYWORD_FAIL;
}

The above code would update the excel with a fail and still continue the execution.


M
Replied on 30/01/2017

InvocationTargetException can be caused because of many reasons send the complete stack trace.


M
Replied on 31/01/2017

Here is the full stack trace

Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at strattonTest.DriverScript.executeKeywords(DriverScript.java:187)
at strattonTest.DriverScript.start(DriverScript.java:127)
at strattonTest.DriverScript.main(DriverScript.java:73)
Caused by: junit.framework.ComparisonFailure: expected:<[]601.32> but was:<[$]601.32>
at junit.framework.Assert.assertEquals(Assert.java:100)
at junit.framework.Assert.assertEquals(Assert.java:107)
at strattonTest.Keywords.VerifyText(Keywords.java:149)
... 7 more


M
Replied on 31/01/2017

zip and send the project.


M
Replied on 01/02/2017

Here is the whole project I am working over.


M
Replied on 01/02/2017

I'm not getting that error, that means that there is a problem with the configuration on your system.

start with deleting your jar files and downloading the latest version of all your jar files again.


M
Replied on 06/02/2017

I tried doing what you said. Below is the list of the new jar files I added. But no luck. Please let me in case I missed any.

All the jar files with Sel 3.01
*******Below is the list of the Jar that came with the latest POI.*******
log 4j 1.2.14
commons-codec-1.10
commons-collections4-4.1
commons-logging-1.2
junit-4.12
dom4j-1.1
poi-3.15
poi-ooxml-3.15
poi-ooxml-schemas-3.15
xmlbeans-2.6.0
curvesapi-1.04
poi-examples-3.15
poi-excelant-3.15
poi-scratchpad-3.15
******These are the files that were there in your Jar folder so thought of adding them as well.*******
mail.jar
saxon-8.7
SaxonLiaison


M
Replied on 06/02/2017

can you come on skype?


M
Replied on 07/02/2017

Yes I can. Please let me know the time you are available to connect.
P.S: I am in Melbourne.


M
Replied on 07/02/2017

give the time and date that you're available.


M
Replied on 07/02/2017

I'll be available after my working hours i.e between 6:30PM-10:30PM (Australian Eastern Daylight Time (AEDT)) during weekdays (prefered) 8-10 Feb and then 13 onwards.


M
Replied on 08/02/2017

give your skype id if you're available now.


M
Replied on 08/02/2017

Sorry I missed your message. Please let me know under which timezone you live. I believe it is better if we book our calendars and then meet on that specific time.


M
Replied on 08/02/2017

mon to Friday 10:30 am to 5 pm IST.


M
Replied on 09/02/2017

Great so let's meet on monday @4:00pm IST, let me know if you want to push it a bit early(before 4:00pm). My skype id is vinayak.bahri. Please share yours skype id as well. I have tried adding you in my account but still want to be double sure.

Talk to you soon.


M
Replied on 09/02/2017

you're from delhi?


M
Replied on 10/02/2017

Yes


M
Replied on 13/02/2017

Hi,
Please let me know when you are available to do skype chat.
Thanks
Vinayak


M
Replied on 14/02/2017

how about 4 pm (IST) today 15 feb.


M
Replied on 06/03/2017

Hi ashish,

Can we schedule a call now? I am still stuck on the same step i.e. the system giving me error while running the cases.

Thanks
Vinayak


M
Replied on 06/03/2017

what is your skype id?