Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

'Could not convert Native argument arg 0' error with Firefox14 #4309

Closed
lukeis opened this issue Mar 3, 2016 · 49 comments
Closed

'Could not convert Native argument arg 0' error with Firefox14 #4309

lukeis opened this issue Mar 3, 2016 · 49 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 3, 2016

Originally reported on Google Code with ID 4309

This error occurs inconsistently when using find_element on FF14 + Se Remote Server
2.25 (with the 2.24 and 2.25 se-webdriver ruby gem)...
Selenium::WebDriver::Error::UnknownError: Could not convert Native argument arg 0 [xpcIJSWeakReference.get]

It doesn't happen often but when it does, it tends to block a test running because
it happens during a simple find_element lookup. I have seen this fail using css-based
id lookups and also with execute script. In the case of the css-based id lookups, I
was able to replace them with xpath-based id lookups and have things work again. In
the case of execute script, I haven't found a workaround.

Reported by andy.kriger on 2012-07-25 18:08:32

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

+1! Seen on FF14 running on Ubuntu 12.04. It happens when using ID locators.

Reported by jonsibonsi on 2012-07-26 04:02:34

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

it is not only on ubuntu on win 7 too

WebDriver C# bindings 

Reported by shabazia09 on 2012-07-31 15:44:27

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Should have noted in original report that this was originally seen on Mac + Linux

Reported by andy.kriger on 2012-07-31 16:27:47

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by barancev on 2012-08-02 19:30:28

  • Labels added: Component-WebDriver, Browser-Firefox

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

+1 - Seen on FF 14.0.1

org.openqa.selenium.WebDriverException: Could not convert Native argument arg 0 [xpcIJSWeakReference.get]

System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version:
'1.7.0_03'
Driver info: driver.version: RemoteWebDriver
    at 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)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:188)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:498)
    at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:287)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementsByXPath(RemoteWebDriver.java:357)
    at org.openqa.selenium.By$ByXPath.findElements(By.java:338)
    at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:256)
....

Reported by joshi.saurin on 2012-08-03 14:20:46

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

In my test code, this issue occurs consistently when attempting to take a screenshot.
However, it does appear to be caused by a combination of factors since it is not reproducible
_ALL_ of the time.

Reported by freddy.vega001 on 2012-08-03 16:28:24

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Are we going to get a fix for this any soon 

Assuming the issue was FF14 i downgraded to FF13.
I still see this issue.

As mentioned by other members it is not on a particular action like clicking an element,taking
a screenshot or a combination of factors.

Consistently able to reproduce.

Reported by shabazia09 on 2012-08-08 09:58:00

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Messages in error console (FF 14.0.1/WebDriver 2.25.0) for getText():

[INFO] command_processor.js:10128 Executing: findElement

[INFO] command_processor.js:10128 Executing: getElementText

Error: [Exception... "Could not convert Native argument arg 0 [xpcIJSWeakReference.get]"
 nsresult: "0x8057000a (NS_ERROR_XPC_BAD_CONVERT_NATIVE)"  location: "JS frame :: file:///<path_to_webdriver_profile>/extensions/fxdriver@googlecode.com/components/session.js
:: <TOP_LEVEL> :: line 1453"  data: no]
Source File: file:///<path_to_webdriver_profile>/extensions/fxdriver@googlecode.com/components/session.js
Line: 1453

[WARNING] driver_component.js:5895 =============
Supported interfaces: nsIClassInfo, nsIXPCException, nsIException, nsISupports, 
------------
    QueryInterface:  function()
    columnNumber: 0
    data: null
    filename: file:///<path_to_webdriver_profile>/extensions/fxdriver@googlecode.com/components/session.js
    initialize:  function()
    inner: null
    lineNumber: 1453
    location: JS frame :: file:///<path_to_webdriver_profile>/extensions/fxdriver@googlecode.com/components/session.js
:: <TOP_LEVEL> :: line 1453
    message: Could not convert Native argument arg 0 [xpcIJSWeakReference.get]
    name: NS_ERROR_XPC_BAD_CONVERT_NATIVE
    result: 2153185290
=============

In addition, after this error current frame is reset to top window.

Reported by nebehr.gudahtt on 2012-08-10 14:45:42

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

+1 Seen on FF 14.0.1 and Windows 7 64 bit

org.openqa.selenium.WebDriverException: Could not convert Native argument arg 0 [xpcIJSWeakReference.get]
Command duration or timeout: 34 milliseconds
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 22:18:01'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version:
'1.6.0_31'
Driver info: driver.version: RemoteWebDriver
    at 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)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:188)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:498)
    at org.openqa.selenium.remote.RemoteWebDriver$RemoteTargetLocator.defaultContent(RemoteWebDriver.java:764)

Reported by SQAEngr on 2012-08-14 21:36:23

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Environment: FF 14.0.1
I am trying to retrieve a value from a table. I am getting Could not convert Native
arg 0 [xpcIJSWeakReference.get]
.... 
Any idea when this issue will be resolved????. It is like a show stopper. 

WebElement table_element =  driver.findElement(By.xpath(".//*[@id='table']"));
                //WebElement table_element = ff.findElement(By.id("dgRequiredServices"));

        System.out.println("Debug # 1");
        List<WebElement> tr_collection=table_element.findElements(By.xpath(".//*[@id=table]/tbody/tr"));

        System.out.println("NUMBER OF ROWS IN THIS TABLE = "+tr_collection.size());




Reported by aha.praveen on 2012-08-16 19:55:22

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

It looks like all developers are in summer break! :) 

Reported by jonsibonsi on 2012-08-16 20:22:08

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Same issue exist in ff 14 , Selenium V2.22.0 in linux .when try to access particular
element multiple times

Reported by kkselvi91 on 2012-08-21 11:52:03

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Also happens when navigate backward in browser.

Reported by roomhunt4me on 2012-08-21 13:06:23

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Also happens when i use this:
driver.navigate().refresh();

Reported by sabf81 on 2012-08-23 13:54:29

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Disclaimer: I am pretty novice with selenium and coding
But: This was happening to me as I was using br.find_elements_by_class and I just used
an xpath instead and now it works fine.

2 cents.

Reported by christophertibbals on 2012-08-28 19:49:02

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Am still able to hit this, with and without XPath

Upgraded to FF 15 in hopes of reprieve.... new day, new error message, same problem:


Selenium::WebDriver::Error::UnknownError: Component returned failure code: 0x80004005
(NS_ERROR_FAILURE) [xpcIJSWeakReference.get]
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:08:56'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.7.4', java.version:
'1.6.0_33'

Reported by jason.lunn on 2012-08-31 17:17:11

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

This issue exist in ff 16 , Selenium 2.25.0 in linux .Component returned failure code:
0x80004005 (NS_ERROR_FAILURE) [xpcIJSWeakReference.get]
     [java] Command duration or timeout: 60 milliseconds
     [java] Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:09:54'
     [java] System info: os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-37-generic',
java.version: '1.6.0_25'
     [java] Driver info: driver.version: RemoteWebDriver

Reported by kkselvi91 on 2012-09-03 09:23:52

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I have this error too on windows with firefox 15: 

Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Component
returned failure code: 0x80004005 (NS_ERROR_FAILURE) [xpcIJSWeakReference.get]
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:08:56'
System info: os.name: 'Windows 2003', os.arch: 'x86', os.version: '5.2', java.version:
'1.6.0_31'
Driver info: driver.version: unknown
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 22:18:01'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-5-amd64', java.version:
'1.6.0_33'
Driver info: driver.version: unknown

Reported by joseibert on 2012-09-04 14:27:23

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Can a Selenium developer chime in on when this might be addressed? We're at the point
of writing off FF testing because each day brings more tests breaking due to this problem.
A little understanding of the problem from someone more involved and a little understanding
of when we can expect a fix would help for planning (specifically, wrt to looking for
alternatives to Selenium).

Reported by andy.kriger on 2012-09-04 15:23:45

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I got the same thing when trying to store a list of WebElements using xpath. I feel
like this has been happening when I upgraded to Ubuntu 12.04. Using FF 15.

Exception e: org.openqa.selenium.WebDriverException: Component returned failure code:
0x80004005 (NS_ERROR_FAILURE) [xpcIJSWeakReference.get]
Command duration or timeout: 52 milliseconds
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:09:54'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-30-generic', java.version:
'1.6.0_31'
Driver info: driver.version: FirefoxDriver
org.openqa.selenium.WebDriverException: Component returned failure code: 0x80004005
(NS_ERROR_FAILURE) [xpcIJSWeakReference.get]
Command duration or timeout: 52 milliseconds
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:09:54'

Reported by bkeelon on 2012-09-10 19:38:53

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I also heard version 2.25.0 is not compatible for FF 15 and 14. Not sure about 13 either,
but it might not be compatible with that version either. 

Reported by bkeelon on 2012-09-10 20:19:28

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Please fix this issue quickly. We are unable to continue our test with latest ff version
in linux

Reported by kkaruppasamy@sirahu.com on 2012-09-13 12:33:28

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I can't see anything obviously wrong about our xpcIJSWeakReference usage in javascript/firefox-driver/js/wdsession.js:181.


I have a feeling this is a bug in Firefox (>= 14), but it's going to be hard to track
down unless someone can provide a small example (HTML/JS/CSS + WebDriver code) that
will reproduce the problem. Even if it does so only some of the time (e.g. 1/100 runs),
it's better than nothing.


Reported by jari.bakken on 2012-09-14 22:06:02

  • Status changed: NeedsClarification
  • Labels removed: Status-Untriaged

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Here's an example.

Lets take this travel site cheapflights.co.uk

Steps to reproduce this error

1. land on http://cheapflights.co.uk
2.Click a link once it os rendered
3.go back through browser.
4. click on second link
5. go back through browser(driver.navigate.back();)

Doing this process a few times each time clicking a new link.Results in the
error.
Hope this helps.

Pls let me know if you need further information.

Reported by shabazia09 on 2012-09-17 19:42:13

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Could you kindly tell me when this problem could be fixed? Otherwise, on ff14 and 15,
I could not execute gui test cases, 20% cases will fail due to this problem. Thanks.

Reported by snowingbear on 2012-10-04 00:56:01

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Even after summer break ...

We still don't see any news on this bug ..

Not even if it's triaged to be fixed ,not to fixed or not a bug

Reported by shabazia09 on 2012-10-04 09:31:56

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Once again I discovered this annoying error. This time on my mac while using selenium
locally (without selenium server):

org.openqa.selenium.WebDriverException: Component returned failure code: 0x80004005
(NS_ERROR_FAILURE) [xpcIJSWeakReference.get]
Command duration or timeout: 33 milliseconds
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 22:18:01'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.1', java.version:
'1.6.0_35'
Driver info: driver.version: FirefoxDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:188)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:498)
    at org.openqa.selenium.firefox.FirefoxDriver.access$100(FirefoxDriver.java:74)
    at org.openqa.selenium.firefox.FirefoxDriver$2$1.implicitlyWait(FirefoxDriver.java:217)

Reported by joseibert on 2012-10-08 11:32:18

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I opened firebug trying to get some clues, it seems that every time when the error of
"Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [xpcIJSWeakReference.get]"
I always get the warning previously:
[18:05:11.224] A form was submitted in the windows-1252 encoding which cannot encode
all Unicode characters, so user input may get corrupted. To avoid this problem, the
page should be changed so that the form is submitted in the UTF-8 encoding either by
changing the encoding of the page itself to UTF-8 or by specifying accept-charset=utf-8
on the form element. @ file:///tmp/tmpWAwHvR/extensions/fxdriver@googlecode.com/components/synthetic_mouse.js:5975

But I am not sure whether these two errors have some relationship

Reported by snowingbear on 2012-10-09 02:26:25

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Raised an issue on Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=800957

Reported by barancev on 2012-10-12 16:09:39

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

This issue was closed by revision r17963.

Reported by barancev on 2012-10-12 20:48:51

  • Status changed: Fixed

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Which Selenium version will contain this fix, and when will it be released?

Reported by SQAEngr on 2012-10-15 21:45:43

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Verified fixed using a locally built selenium-server from svn trunk

Reported by andy.kriger on 2012-10-16 02:21:22

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

It should go in 2.26, that's to be landed as soon as we repair our CI server.

Reported by barancev on 2012-10-16 05:52:47

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Thanks Alexei Barantsev  for the fix and update. May i know when we are planning release
2.26 ? 

Thanks for your time.

Reported by raghu.feb03 on 2012-10-17 06:46:47

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Thanks for barancev

Reported by snowingbear on 2012-10-17 08:56:11

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I'm not seeing this error anymore in 2.26 + Firefox 16.0 but I noticed some intermittent
NoSuchElementException's which don't make sense. The element is clearly there. Again,
downgrading Firefox will save your day.

Reported by jonsibonsi on 2012-11-03 00:57:19

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

@jonsibonsi: Please open a new issue and provide a sample. Intermittent is OK, but we
need to have a page where this happens.

Reported by barancev on 2012-11-03 07:49:35

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I believe this is a Firefox bug and you've already opened a bug on a related issue:
https://bugzilla.mozilla.org/show_bug.cgi?id=800957 which is still open.

Reported by jonsibonsi on 2012-11-03 08:03:37

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

When will 2.26 be released?

Reported by SQAEngr on 2012-11-05 16:56:20

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

2.26 is already released and you can download it from http://code.google.com/p/selenium/downloads/list

The Downloads page however is not yet updated.

Reported by jonsibonsi on 2012-11-05 18:28:35

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I'm having the same problem as described in comment 39:

"I'm not seeing this error anymore in 2.26 + Firefox 16.0 but I noticed some intermittent
NoSuchElementException's which don't make sense. The element is clearly there. Again,
downgrading Firefox will save your day."

Did you open a new issue for that? What the number?

Reported by caroline.rivera15 on 2012-11-21 13:14:38

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Not yet, I'm trying to find a better way to reproduce the issue.

Does your page contain any frames/iframes?

Reported by jonsibonsi on 2012-11-21 18:13:23

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Yes (iframes)...

I put some "Thread.sleep(10000)" on my code for the specific test that was causing
the error and it worked. 
But then, another test failed with the same error. So I put the same "Thread.sleep(10000)"
on this test code... but it didn't work .... 

Reported by caroline.rivera15 on 2012-11-22 12:37:37

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

That's right! We also have iframes and the target element is inside the frame.

I have a theory that Firefox sometimes resets the frame for some reason (sets it to
top most frame) .selenium still believes the context is still inside the frame and
it fails! Adding sleeps didn't do any good for me either, so what you're saying proves
what I'm seeing here :) thanks! 

Reported by jonsibonsi on 2012-11-22 16:24:11

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I can confirm that Firefox seems to arbitrarily switch back to the topmost frame. My
workaround is to catch the relevant NoSuchElementExceptions, attempt to switch back
to the iframe if one is found, and then try again. It was a bit of a pain to set up,
but I haven't been bothered by this specific issue again.

Reported by alex.huijsman@rewardstream.com on 2012-11-22 17:17:44

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Dear friends, please raise a new issue and apply a reproduction sample, otherwise we
have no basis to act on.

Reported by barancev on 2012-11-23 10:59:41

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I recently implemented Alex's solution from above and that seemed to work for me.  Basically
have to create a wrapper around WebDriver to catch any NoSuchElementExceptions and
retry after resetting the context to the correct frame/iframe.  Only fails if it still
can't find the element.

A little bit of overhead, but working fine for me.

Reported by swimminschrage on 2013-01-08 01:38:59

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

actually,what time that this issues can be solve. 

Reported by xiaoming.ye@dcfservice.net on 2014-10-16 06:31:27

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by luke.semerau on 2015-09-17 18:15:52

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 3, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant