t.replace is not a function in selenium RC - java

I am using selenium 2.25 with firefox 3.6 and I am facing issues when i run my scripts.
Below is the error in my console and system displaying alert message as "Type error $j undefined"
ERROR: Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window. The error message is: t.replace is not a function
May I know what is the problem here, the scripts which I used were running fine earlier, but from last week eclipse showing error as above when I run my scripts.
Selenium version:2.25
OS:Windows 7.0
Browser:Firefox
Browser version:3.6

t.replace is not a function is normally caused by trying to perform a replace on a null in JavaScript.
I suspect you are trying to interact with something on the page before all the JavaScript has finished loading and this is causing the error. This will be intermittant because sometimes the page will have fully loaded and the JavaScript on the page will have processed correctly. whilst at other times Selenium may get in there a bit too quickly.
Generally have your devs check their javaScript code, there is a path that results in a replace being performed on a null. They should have some code to protect against things like this, it's caused by bad quality code.
Basically you have found a bug.

Related

How come Eclipse IDE executing AutoIt script breaks page layout, but not when debugging?

Having a very strange problem, been trying to debug it with no success. I'm automating a web application using Selenium Webdriver in Java using Eclipse as the IDE. In the process of diagnosing, Chrome, Eclipse and the Java project (via Maven) have all been updated.
One area of test case coverage involves opening an upload file picker within Chrome, selecting a file, and clicking Open to upload the file and close the picker. As Selenium cannot interact with these pickers I invoke Runtime.getRuntime().exec() to run a simple AutoIt script, along with the filepath:
ControlFocus("Open","","Edit1")
ControlSetText("Open","","Edit1", $CmdLine[1])
ControlClick("Open","","Button1")
Historically, this script has worked perfectly and has no obvious reason to break.
At the point where the Runtime line above is ran in the project, the rendering of the page will change. The entire page appears ~30 pixels higher than normal. If you mouse-over any button they will not be clickable unless you move your mouse 30px down to the empty space below. This breaks any further automation because buttons are no longer clickable.
In reproducing this I made the following discoveries:
This cannot be reproduced manually.
While debugging, I set a breakpoint at the runtime line (which appears to be the line causing the issue). If I click Resume the problem appears at the point it executes the Runtime line. If I click Step Over/Step Into, it executes the Runtime line without causing the problem.
Refreshing the page manually fixes the rendering issue.
Refreshing the page via Selenium does not fix the rendering issue, and so is not a workaround.
I am totally lost. Manual input is the only way to temporarily resolve the issue, which defeats the point of automation. I have not seen anyone else have the same problem.

'The operation can not be performed' - Error message in QTP

I am using QTP to automate a Java Application.
With the following code, I am trying to maximize a JavaWindow which is simply taken from QTP's record and playback.
JavaWindow("MyAppWindow").Maximize
This code is working fine in most of the cases. But, at some rare cases, it turned out to be a failure. QTP is throwing an error as "The operation can not be performed"
I stopped the QTP execution and tried to record one more time for the JavaWindow to get maximized. Surprisingly, QTP is not generating any code for any sort Window events to the JavaWindow. If I do any close or click in any of the elements in that window, then it is working fine.
Why this strange behavior ? How to avoid these sort of errors ?

Xpath does not work running (in eclipse) but working on Debug mode as well as Selenium IDE

selenium.type("search-query", "case");
selenium.click("//div[#id='advanced-search-box']/a[1]");
selenium.click("//table[#id='search-results-table']/tbody/tr[*]/td[2]/a[#class='result-name']");
selenium.waitForPageToLoad("30000");
assertTrue(selenium.isTextPresent("case"));
Result:
com.thoughtworks.selenium.SeleniumException: ERROR: Element //table[#id='search-results-table']/tbody/tr[*]/td[2]/a[#class='result-name'] not found
What does
selenium.click("//div[#id='advanced-search-box']/a[1]");
do as you are not waiting for a new page to load, or any ajax to happend. If something is happening then you need to wait for it. The reason it would work in debug mode is because you are slowly stepping over each step (and thus there is enough time for anything to happen). It would also work in Selenium IDE because it is not as faster as the JUnit runner.

Error calling method on NPObject when calling Java Applet Method from GWT Client code

I receive this error when calling a Java Applet method from GWT JavaScript client code.
The really strange thing is, this error only occurs when I create a certain object in the said applet method. Specifically, I have a class I created in the GWT "shared" folder, which serializes a class into a JSON string from an instance of this class within the client javascript. The Java applet also instanciates this class in java space, within the said method. When I don't attempt to instanciate this class within the applet method, it runs and returns no problem. Shouldn't the java instanciation be totally independant of GWT? Also, I wonder why i'm not getting a stack trace in my java console if this exception is occurring within java.
Not sure if this is relevant, but I'm using the GWTAI project for Applet->JavaScript callbacks
TIA for any responses,
Phaedrus
02:40:22.848 [ERROR] [u] Uncaught exception escaped
com.google.gwt.core.client.JavaScriptException: (Error): Error calling method on NPObject.
stack: Error: Error calling method on NPObject.
at [object Object]. (unknown source)
at __gwt_jsInvoke (http://127.0.0.1:8888/u/hosted.html?u:76:35)
I don't know if you've come to a solution on that one but bear in mind that GWT plugin in Chrome returns that kind of errors running the debug mode IF the object you're trying to deserialize/"javascript-ify" is too big. Apparently it has to do with some kind of stack size somehow...
I've noticed that it works great on Safari for mac and of course when code is compiled... how annoying! I'm testing everything on a mac safari now since it's the only webkit-based plugin we have at the moment.
Hope that helps and good luck!
To solve this issue, I'll give you the following solution. This worked for me.
Go to Chrome's "Settings" and then choose "Extensions" or you can use the follow url link to access Extensions directly "chrome://extensions/" . There deselect "Developer Mode".
My version of Chrome is 34.

Error whenever a java applet is loaded

For the past few months or so, I've been getting an error whenever I attempt to use a java applet.
I'm getting this error on every browser I use, and I get the error occasionally in linux, too.
The java applet loads for roughly 5 seconds or so, then it stops and I get two error messages, stating that an exception occurred (java.io.EOFException).
This seems to happen regardless of what website I'm using. Going to the website shows I'm running java 6 update 20, and I get no error. Googling the error turns up nothing useful - I'm not a java developer, so most of the results don't apply to me at all.
My question is this. What's causing this error, and what can I do to fix whatever issue is causing it?
Nevermind. I looked further, turns out I had to delete the trusted.certs file under ~/Application Data/Sun/Java/Deployment/Security (~/.java/deployment/security in linux). That solved the problem.

Categories